The architecture of Tunisia began with the ancient civilizations such as the Carthaginians, Numidians, and Romans. After the 7th century, Islamic architecture developed in the region under a succession of dynasties and empires. In the late 19th century French colonial rule introduced European architecture, and modern architecture became common in the second half of the 20th century. The southern regions of the country are also home to diverse examples of local vernacular architecture used by the Berber (Amazigh) population.

Antiquity

Punic Carthage Large regions of North Africa, particularly near the coasts, came under the control of Carthage, a Phoenician civilization, at the height of its power in the third century BC. The remains of Carthage are found near Tunis today and contain the remains of multiple periods ranging from the Punic period to the later Arab occupation. Vestiges of the Punic period include the "Punic Ports" (the city's ancient harbors) and a sanctuary and necropolis dedicated to Baal Hammon, known today as the Sanctuary of Tophet.

Numidia The kingdom of Numidia was contemporary with the Carthaginian civilization and the Roman Republic. Among other things, the Numidians have left thousands of pre-Christian tombs. The oldest of these is Medracen in present-day Algeria, believed to date from the time of Masinissa (202–148 BC), which consists of a tumulus structure in ashlar masonry. Elsewhere, a number of "tower tombs" from the Numidian period can also be found in sites from Algeria to Libya. Despite their wide geographic range, they often share a similar style: a three-story structure topped by a convex pyramid. They may have initially been inspired by Greek monuments but they constitute an original type of structure associated with Numidian culture. An important example in present-day Tunisia is the Libyco-Punic Mausoleum at the site of Dougga.

Roman and Byzantine period

After defeating Carthage, Rome progressively took over the entire coast of North Africa from Egypt to the Atlantic coast of modern-day Morocco. Most of present-day Tunisia was occupied by the Roman province known as Africa. Significant remains of Roman architecture can be found in Tunisia today, including Roman Carthage, the amphitheater of El Jem, the site of Dougga (Thugga), the temples of Sbeitla (Sufetula), and others. After the fall of the Western Roman Empire, the Eastern Roman or Byzantine Empire continued to rule parts of the region up until the 7th century.

Early Islamic period

In the 7th century the region of North Africa became steadily integrated into the emerging Muslim world during the Early Arab-Muslim Conquests. The territory of Ifriqiya (roughly present-day Tunisia), and its newly founded capital city of Kairouan (also transliterated as "Qayrawan") became an early center of Islamic culture for the region. The Great Mosque of Kairouan was founded here by Uqba ibn Nafi in 670, though it was rebuilt under the Aghlabids. Islamic architecture continued to develop in the region afterwards.

Aghlabids

In the 9th century the province of Ifriqiya, while still nominally under the control of the Abbasid Caliphs in Baghdad, was de facto ruled by the Aghlabid dynasty. The Aghlabids were major builders and erected many of Tunisia's oldest Islamic-era monuments, including military structures like the Ribat of Sousse and the Ribat of Monastir, religious buildings like the Great Mosque of Sousse and the Great Mosque of Sfax, and practical infrastructure works like the Aghlabid Reservoirs of Kairouan. The al-Zaytuna Mosque in Tunis, which was founded earlier around 698, owes its overall current form to the Aghlabid emir Abu Ibrahim Ahmad (r. 856–863). Much of Aghlabid architecture, even their mosques, had a heavy and almost fortress-like appearance, but they nonetheless left an influential artistic legacy. For example, the Mosque of Ibn Khayrun (also known as the "Mosque of the Three Doors") possesses what is considered by some to be the oldest decorated external façade in Islamic architecture, featuring carved Kufic inscriptions and vegetal motifs.

One of the most important Aghlabid monuments is the Great Mosque of Kairouan, which was completely rebuilt by the emir Abu Muhammad Ziyadat Allah (r. 817–838) in 836, although various additions and repairs were effected later which complicate the chronology of its construction. The mosque features an enormous rectangular courtyard, a large hypostyle prayer hall, and a thick three-story minaret (tower from which the call to prayer was issued). The mihrab (niche symbolizing the direction of prayer) of the prayer hall is among the oldest examples of its kind, richly decorated with marble panels carved in high-relief vegetal motifs and with ceramic tiles with overglaze and luster. Next to the mihrab is the oldest surviving minbar (pulpit) in the world, made of richly carved teakwood panels. Both the carved panels of the minbar and the ceramic tiles of the mihrab are believed to be imports from Abbasid Iraq. An elegant dome in front of the mihrab with an elaborately decorated drum is one of architectural highlights of this period.

Fatimids

In Ifriqiya, the Fatimids also built extensively, most notably with the creation of a new fortified capital on the coast, Mahdia. Construction began in 916 and the new city was officially inaugurated on February 20, 921, although some construction continued. In addition to its heavy fortified walls, the city included the Fatimid palaces, an artificial harbor, and the Great Mosque of Mahdia. Much of this has not survived to the present day. Fragments of mosaic pavements from the palaces have been discovered from modern excavations. The mosque is one of the most well-preserved Fatimid monuments in the Maghreb, although it too has been extensively damaged over time and was in large part reconstructed by archeologists in the 1960s. It consists of a hypostyle prayer hall with a roughly square courtyard. The mosque's original main entrance, a monumental portal projecting from the wall, was relatively unusual at the time and may have been inspired by ancient Roman triumphal arches. Another unusual feature was the absence of a minaret, which may have reflected an early Fatimid rejection of such structures as unnecessary innovations.

Islamic Berber dynasties

Zirids After the Fatimids moved their base of power to Cairo, Egypt, in the 10th century, new Berber dynasties such as the Zirids ruled nominally on their behalf. As independent rulers, however, the Zirids of Ifriqiya built relatively few grand structures. They reportedly built a new palace at al-Mansuriyya, a former Fatimid capital near Kairouan, but it has not been found by modern archeologists. In Kairouan itself the Great Mosque was restored by Al-Mu'izz ibn Badis. The wooden maqsura within the mosque today is believed to date from this time. It is the oldest maqsura in the Islamic world to be preserved in situ and was commissioned by al-Mu῾izz ibn Badis in the first half of the 11th century (though later restored). It is notable for its woodwork, which includes an elaborately carved Kufic inscription dedicated to al-Mu'izz. The Qubbat al-Bahw, an elegant dome at the entrance of the prayer hall of the al-Zaytuna Mosque in Tunis, dates from 991 and can be attributed to Al-Mansur ibn Buluggin.

Hafsids (and Almohads)

The patronage of the Almohads – as well as of the Almoravids who preceded them in the western Maghreb – is considered one of the most formative stages of "Moorish" (western Islamic) architecture, establishing many of the forms and motifs that defined architectural styles in the region during the subsequent centuries. Ifriqiya was far from the main Almohad capital at Marrakesh (present-day Morocco) and the Almohads themselves did not leave significant monuments here. However, they made Tunis the regional capital of their territories in Ifriqiya and established the city's kasbah (citadel) as their center of government.

The Hafsids, a branch of the Almohad ruling class, declared their independence from the Almohads in 1229 and developed their own state which came to control much of Ifriqiya and some of the surrounding region. They were also significant builders, particularly under the reigns of successful leaders like Abu Zakariya (ruled 1229–1249) and Abu Faris (ruled 1394–1434), though not many of their monuments have survived intact to the present-day. While Kairouan remained an important religious center, Tunis was the capital and progressively replaced it as the main city of the region and the main center of architectural patronage. Unlike the architecture further west, Hafsid architecture was built primarily in stone (rather than brick or mudbrick) and appears to have featured much less decoration. In reviewing the history of architecture in the region, scholar Jonathan Bloom remarks that Hafsid architecture seems to have "largely charted a course independent of the developments elsewhere in the Maghrib [North Africa]".

The Kasbah Mosque of Tunis was one of the first works of this period, built by Abu Zakariya (the first independent Hafsid ruler) at the beginning of his reign. Its floor plan had noticeable differences from previous Almohad-period mosques but the minaret, completed in 1233, bears very strong resemblance the minaret of the earlier Almohad Kasbah Mosque in Marrakesh. This Hafsid minaret influenced the design of later Tunisian minarets. Other foundations from the Hafsid period in Tunis include the Haliq Mosque (13th century) and the al-Hawa Mosque (1375), and the Bab al-Aqwas Mosque (15th century). The Hafsids also made significant renovations to the much older Great Mosque of Kairouan – renovating its ceiling, reinforcing its walls, and building or rebuilding two of its entrance gates in 1293 – as well as to the al-Zaytuna Mosque in Tunis. The Bardo Palace (today a national museum) was also begun by the Hafsids in the 15th century, and is mentioned in historical records for the first time during the reign of Abu Faris.

The Hafsids also introduced the first madrasas to the region, beginning with the Madrasa al-Shamma῾iyya built in Tunis in 1238 (or in 1249 according to some sources). This was followed by many others (almost all of them in Tunis) such as the Madrasa al-Hawa founded in the 1250s, the Madrasa al-Ma'ridiya (1282), and the Madrasa al-Unqiya (1341). Many of these early madrasas, however, have been poorly preserved or have been considerably modified in the centuries since their foundation. The Madrasa al-Muntasiriya, completed in 1437, is among the best preserved madrasas of the Hafsid period.

The Mausoleum of Sidi Qasim al-Jalizi, in the suburbs west of Tunis, was built towards the end of the 15th century (), founded by Sidi Qasim al-Jalizi (d. 1496), a zellij craftsman of Andalusi origin who was buried here at his death. While expanded in later centuries, the main mausoleum chamber still dates to the Hafsid period and displays a fusion of styles that is characteristic of the period. Rather than covered by a traditional vault or spherical dome, the chamber is covered by a pyramidal wooden roof with green tiles on the outside, typical of contemporary buildings further west in Morocco and al-Andalus. The hall's interior is decorated with several elements also characteristic of architecture further west, including carved stucco on the upper walls, flowery capitals, and cuerda seca tiles on the mihrab niche and lower walls that appear to be a local interpretation of the Hispano-Moresque style. On the other hand, the hall also features marble decoration on walls, columns, and around the framing of arches, which appear to be influenced by Ayyubid and Mamluk architecture further east.

Ottoman period