Heine was born into a Jewish family in Düsseldorf, Germany. His father was a tradesman, who during the French occupation found new prospects opening up for Jews. When his father's business failed, Heine was sent to Hamburg, where his rich banker uncle Salomon tried to encourage him into a commercial career, without success. He studied law at the universities of Göttingen, Bonn and Berlin, but was more interested in literature than law, although he eventually took a degree in 1825. He converted to Protestantism that year.

Heine is best known for his lyric poetry, much of which was set to music by lieder composers, most notably Franz Schubert and Robert Schumann.

As a poet Heine made his debut with "Gedichte" in 1821. Heine's one-sided infatuation with his cousins Amalie and Therese later inspired him to write some of his loveliest lyrics; "Buch der Lieder" (1827) was Heine's first comprehensive collection of verse.

Heine left Germany for Paris, France in 1831. There he associated with utopian socialists, such as Count Saint-Simon, who preached of an egalitarian classless paradise based on meritocracy.

He remained in Paris, with the exception of a visit in 1843 to Germany, for the rest of his life. German authorities banned his works and those of others in the Young Germany movement in 1835.

Heine continued, however, to comment on German politics and society from a distance. Heine wrote "Deutschland: Ein Wintermärchen" ("A Winter’s Tale"), an account of his visit to Germany the previous year and the political climate there, in 1844; his friend, Karl Marx, published it in his newspaper Forwards in 1844. Heine also satirised the utopian politics of those opponents of the regime still in Germany in "Atta Troll: Ein Sommernachstraum" ("A Midsummer Night’s Dream") in 1847.