Ernani is an operatic dramma lirico in four acts by Giuseppe Verdi to an Italian libretto by Francesco Maria Piave, based on the play Hernani by Victor Hugo.
Verdi was commissioned by the Teatro La Fenice in Venice to write an opera, but finding the right subject took some time, and the composer worked with the inexperienced Piave in shaping first one and then another drama by Hugo into an acceptable libretto. As musicologist Roger Parker notes, the composer "intervened on several important points, insisting for example that the role of Ernani be sung by a tenor (rather than by a contralto as had originally been planned).
Ernani was first performed on 9 March 1844 and it was "immensely popular, and was revived countless times during its early years". It became Verdi's most popular opera until it was superseded by Il trovatore after 1853. In 1904 it became the first opera to be recorded completely.