Amalfi is a town and comune in the province of Salerno, in the region of Campania, Italy, on the Gulf of Salerno. It lies at the mouth of a deep ravine, at the foot of Monte Cerreto (1,315 metres, 4,314 feet), surrounded by dramatic cliffs and coastal scenery. The town of Amalfi was the capital of the maritime republic known as the Duchy of Amalfi, an important trading power in the Mediterranean between 839 and around 1200
Amalfi is the main town of the coast on which it is located, named Costiera Amalfitana (Amalfi Coast), and is today an important tourist destination together with other towns on the same coast, such as Positano, Ravello and others. Amalfi is included in the UNESCO World Heritage Sites.
First mentioned in the 6th century, Amalfi soon afterwards acquired importance as a maritime power, trading grain from its neighbours, salt from Sardinia and slaves from the interior, and even timber, in exchange for the gold dinars minted in Egypt and Syria, in order to buy the Byzantine silks that it resold in the West. Grain-bearing Amalfi traders enjoyed privileged positions in the Islamic ports, Fernand Braudel notes. The Amalfi tables provided a maritime code that was widely used by the Christian port cities. Merchants of Amalfi were using gold coins to purchase land in the 9th century, while most of Italy worked in a barter economy. In the 8th and 9th century, when Mediterranean trade revived it shared with Gaeta the Italian trade with the East, while Venice was in its infancy, and in 848 its fleet went to the assistance of Pope Leo IV against the Saracens.
An independent republic from the 7th century until 1075, Amalfi extracted itself from Byzantine vassalage in 839 and first elected a duke in 958; it rivalled Pisa and Genoa in its domestic prosperity and maritime importance before the rise of Venice. In spite of some devastating setbacks it had a population of some 70,000 to 80,000 reaching a peak about the turn of the millennium, during the reign of Duke Manso (966–1004). Under his line of dukes, Amalfi remained independent, except for a brief period of Salernitan dependency under Guaimar IV.
In 1073 the republic fell to the Norman countship of Apulia, but was granted many rights. A prey to the Normans who encamped in the south of Italy, it became one of their principal posts. However, in 1131, it was reduced by King Roger II of Sicily, who had been refused the keys to its citadel. The Holy Roman Emperor Lothair, fighting in favour of Pope Innocent II against Roger, who sided with the Antipope Anacletus, took him prisoner in 1133, assisted by forty-six Pisan ships. The Pisans, commercial rivals of the Amalfitani, sacked the city; Lothair claimed as part of the booty a copy of the Pandects of Justinian which was found there.
In 1135 and 1137, it was taken by the Pisans and rapidly declined in importance, though its maritime code, known as the , was recognized in the Mediterranean until 1570. A tsunami in 1343 destroyed the port and lower town, and Amalfi never recovered more than local importance.
In medieval culture Amalfi was famous for its flourishing schools of law and mathematics. Flavio Gioia, traditionally considered the first to introduce the mariner's compass to Europe, is said to have been a native of Amalfi.
Amalfi has a long history of catering for visitors, with two former monasteries being converted to hotels at a relatively early date, the Luna Convento in the second decade of the 19th century and the Cappuccini Convento in the 1880s. Celebrated visitors to Amalfi included the composer Richard Wagner and the playwright Henrik Ibsen, both of whom completed works whilst staying in Amalfi.