It is divided into the fortified Cité de Carcassonne and the more expansive lower city, the ville basse. Carcassone was founded by the Visigoths in the fifth century, though the Romans had fortified the settlement earlier. The fortress, which was thoroughly restored in 1853 by the theorist and architect Eugène Viollet-le-Duc, was added to the UNESCO list of World Heritage Sites in 1997. The folk etymology – involving a châtelaine named Carcas, a ruse ending a siege and the joyous ringing of bells (" sona") – though memorialized in a neo-Gothic sculpture of Mme. on a column near the , is of modern invention. The name can be derived as an augmentative of the name Carcas.
The first signs of settlement in this region have been dated to about 3500 BC, but the hill site of Carsac – a Celtic place-name that has been retained at other sites in the south – became an important trading place in the 6th century BC. The Volcae Tectosages fortified the oppidum.
Carcassonne became strategically identified when Romans fortified the hilltop around 100 BC and eventually made the colonia of Julia Carsaco, later Carcasum (by the process of swapping consonants known as metathesis). The main part of the lower courses of the northern ramparts dates from Gallo-Roman times. In 462 the Romans officially ceded Septimania to the Visigothic king Theodoric II who had held Carcassonne since 453; he built more fortifications at Carcassonne, which was a frontier post on the northern marches: traces of them still stand. Theodoric is thought to have begun the predecessor of the basilica that is now dedicated to Saint Nazaire. In 508 the Visigoths successfully foiled attacks by the Frankish king Clovis. Saracens from Barcelona took Carcassonne in 725, but King Pepin the Short (Pépin le Bref) drove them away in 759-60; though he took most of the south of France, he was unable to penetrate the impregnable fortress of Carcassonne.
In 1067, Carcassonne became the property of Raimond-Bernard Trencavel, viscount of Albi and Nîmes, through his marriage with Ermengard, sister of the last count of Carcassonne. In the following centuries, the Trencavel family allied in succession either with the counts of Barcelona or of Toulouse. They built the Château Comtal and the Basilica of St. Nazaire and St. Celse. In 1096, Pope Urban II blessed the foundation stones of the new cathedral.
Carcassonne became famous in its role in the Albigensian Crusades, when the city was a stronghold of Occitan Cathars. In August 1209 the crusading army of the Papal Legate, Abbot Arnaud Amalric, forced its citizens to surrender. Raymond-Roger de Trencavel was imprisoned whilst negotiating his city's surrender, and died in mysterious circumstances three months later in his own dungeon. De Montfort was appointed the new viscount. He added to the fortifications.
In 1240, Trencavel's son tried to reconquer his old domain but in vain. The city submitted to the rule of the kingdom of France in 1247. Carcassonne became a border fortress between France and the Kingdom of Aragon under the Treaty of Corbeil (1258). King Louis IX founded the new part of the town across the river. He and his successor Philip III built the outer ramparts. Contemporary opinion still considered the fortress impregnable. During the Hundred Years' War, Edward the Black Prince failed to take the city in 1355, although his troops destroyed the Lower Town.
In 1659, the Treaty of the Pyrenees transferred the border province of Roussillon to France, and Carcassonne's military significance was reduced. Fortifications were abandoned, and the city became mainly an economic centre that concentrated on the woollen textile industry, for which a 1723 source quoted by Fernand Braudel found it "the manufacturing centre of Languedoc".