The son of a Sardinian admiral, Mameli was born in Genoa where his father was in command of the fleet of the kingdom of Sardinia. At the age of 7 he was sent to Sardinia, at his grandfather's, to escape the risk of cholera, but soon came back to Genoa to complete his studies.
Mameli's very short life is concentrated in only two years, in which he was an important leader of insurrectional movements and became a notable figure in Italian Risorgimento.
In 1847 Mameli joined the Società Entelema, a cultural movement that soon would have turned to a political movement, and here he started approaching to the theories of Giuseppe Mazzini.
Mameli is mostly known as the author of the lyrics of the Italian national anthem, Fratelli d'Italia (music was by Michele Novaro). These lyrics were used for the first time in November 1847 celebrating the king Charles Albert, in visit to Genoa after his first reformations.
He was deeply involved in nationalistic movements and some more "spectacular" actions are remembered, like his exposition of the Tricolore (current italian flag, then prohibited) to celebrate the expulsion of Germans in 1846. Yet, he was with Nino Bixio (Garibaldi's later major supporter and friend) in a committee for public health, already on a clear Mazzinian position. In March 1848, hearing of the insurrection in Milan he organised an expedition with 300 other patriots, joined Bixio's troops that were already on site, and entered the town. He was then admitted in Garibaldi's irregular army (really the volunteer brigade of general Torres), as a captain, and meets Mazzini.
Back in Genoa, he worked more on a litterary side, wrote several hymns and other compositions, he became the director of the newspaper Diario del Popolo (people's diary), and promoted a press campaign for a war against Austria. In December 1848 he reached Rome, where Pellegrino Rossi had been murdered, helping in the clandestine works for declaration (February 9, 1849) of the Roman republic. Mameli then went to Florence where he proposed the creation of a common state between Tuscany and Latium.
In April 184 he was again in Genoa, with Bixio, where a popular insurrection was heavily contrast by general Alberto La Marmora. Soon he left again for Rome, where the French had come to support the Papacy (Pope Pius IX factually had escaped from the town) and took active part in the combats. In June he was accidentally injured in his left leg by the bayonet of one of his comrades; the wound was not really serious, but an infection caught him and after a while the leg had to be amputated. Mameli could resist only a few days after the surgery, and died on July 7, at the age of 22.