Portoferraio is a town and commune in the province of Livorno, on the edge of the eponymous harbour of the island of Elba. It is the island's largest city. Because of its terrain, many of its buildings are situated on the slopes of a tiny hill surrounded on three sides by the sea.
Portoferraio was founded by Cosimo I de' Medici, Grand Duke of Tuscany, in 1548, with the name of Cosmopoli ("Cosimo's City"), to balance the presence of the Spanish citadel in Porto Azzurro. It had three forts (Forte Stella, Forte Falcone and Forte Inglese) and a massive line of walls, all still visible today.
The city remained to the Grand Duchy of Tuscany until the 18th century, when, due to its strategic position, it was contended by France, England and Austria. In 1814 it was handed over to Napoleon Bonaparte, as the seat of his first exile. In the 19th century, the city grew quickly, due to the construction of infrastructures and the exploitation of new iron mills in Rio Marina. Portoferraio became then main shipping port of the ore towards the mainland, whence the current name, meaning "Iron Port" in Italian. After the end of the Napoleonic Era, Portoferraio returned to Tuscany, and became part of the Kingdom of Italy in 1860.
Portoferraio's economy suffered from the end of mining activities starting from the 1970s, but in the following decades it gained a status as an internationally renowned tourist resort.