Hagia Sophia History: 1,500 Years in One Building
Hagia Sophia was built between 532 and 537 AD by the Byzantine emperor Justinian I, and inaugurated on 27 December 537. Its designers, Anthemius of Tralles and Isidore of Miletus, were scientists rather than builders, and they finished the largest church in the Christian world in just five years and ten months. That makes the building roughly 1,490 years old today, and Hagia Sophia history since that opening day reads like the story of Istanbul in miniature: imperial cathedral, Latin cathedral, Ottoman mosque, secular museum, and, since 2020, a working mosque once more.
Below, every era in order, with a timeline near the end. For the engineering side, see our guide to the dome and its architecture.
Two Churches Burned Here First
The building you visit is the third church on this spot. The first, called the Megale Ekklesia or “Great Church,” was dedicated in 360 AD and burned down in 404. Its replacement, dedicated in 415 under Emperor Theodosius II, lasted a little over a century before it too was destroyed, torched in January 532 during the Nika Revolt, an uprising that came close to costing Justinian his throne.
Fragments of that second church survive. Carved marble blocks from the Theodosian building still sit in the excavation pit in the west courtyard, and you’ll pass them on your way in.
Who Built Hagia Sophia, and Why So Fast?
Justinian answered the Nika fires with a statement in stone. Within weeks he had commissioned a church grander than anything the Roman world had seen, and he gave the job to an unusual pair. Anthemius of Tralles was a mathematician; Isidore of Miletus was a geometer and physicist. Neither was a master builder by trade, and their science-first thinking produced a dome about 31 metres across that appeared to hover on a ring of light. The result held the title of largest cathedral on Earth for roughly a thousand years, until Seville Cathedral overtook it in 1520.
The Dome Falls, and Rises Steeper (558–562)
Daring design came at a price. Earthquakes weakened the first, shallower dome, and in 558 part of it collapsed. Isidore the Younger, nephew of Isidore of Miletus, rebuilt it about six metres higher and steeper, finishing the work in 562. Sections failed again in 989 and 1346 and were repaired each time, which is why today’s dome is a quiet patchwork of 6th-, 10th- and 14th-century masonry. From the floor of the nave, you’d never know.
Hagia Sophia Before 1453: The Emperors’ Church
From 537 to 1453, Hagia Sophia served as the cathedral of Constantinople, the ceremonial stage of the Byzantine Empire. Emperors were crowned on the omphalion, a circle of coloured marble discs set into the floor of the nave. It’s still there, deliberately left uncovered within the prayer carpet, and you can pick it out from the gallery today. Over the centuries the interior filled with the golden mosaics the building is famous for, from the apse Virgin and Child of 867 to the imperial portrait panels upstairs.
1204: The Latin Interlude
The building’s darkest hour came from fellow Christians. In 1204 the Fourth Crusade sacked Constantinople, and Hagia Sophia spent the next 57 years as a Latin, meaning Catholic, cathedral, until the Byzantines recovered their capital in 1261. Enrico Dandolo, the elderly doge of Venice behind the crusade’s detour, was buried in the upper gallery. His grave marker survives and sits on today’s visitor route.
1453: A Cathedral Becomes a Mosque
On 29 May 1453, Mehmed II, remembered as the Conqueror, took Constantinople, and within the week Hagia Sophia had been converted into a mosque. The first Friday prayer was held on 1 June 1453. The question of what this building is, church or mosque, has been asked and re-answered ever since; we trace all four answers in is Hagia Sophia a mosque?
The Ottoman Centuries
The Ottomans treated Hagia Sophia as the empire’s flagship mosque and kept improving it for over four centuries. A mihrab and minbar reoriented worship toward Mecca. Four minarets rose in stages, one of brick and three of stone; the great architect Mimar Sinan contributed two of them in the 16th century, along with the structural buttresses that have helped hold the building up ever since. Later additions included a sultan’s loge, the library of Mahmud I in the 18th century, fountains and a madrasa.
The eight giant calligraphic roundels, each about 7.5 metres across and painted by the calligrapher Kazasker Mustafa İzzet Efendi in the 1840s, name Allah, the Prophet Muhammad, the four caliphs, and the Prophet’s grandsons Hasan and Husayn. Between 1847 and 1849 the Swiss-Italian Fossati brothers restored the entire structure, documenting the Byzantine mosaics before carefully re-covering them, a decision that quietly saved them for the future.
Museum, Then Mosque Again
In 1934 the young Turkish Republic issued a decree secularising the building, and on 1 February 1935 Hagia Sophia opened as a museum under Atatürk. For 85 years it stood as a monument shared by everyone, and its mosaics returned to public view. Then, on 10 July 2020, Turkey’s Council of State annulled the 1934 decree, and on 24 July 2020 the building reopened for Muslim worship as the Hagia Sophia Grand Mosque, in Turkish the Ayasofya-i Kebir Cami-i Şerifi. It has been a UNESCO World Heritage Site, as part of the Historic Areas of Istanbul, since 1985.
Hagia Sophia History at a Glance
| Year | Event |
|---|---|
| 360 | First church, the Megale Ekklesia, dedicated |
| 404 | First church burns down |
| 415 | Second (Theodosian) church dedicated |
| January 532 | Second church destroyed in the Nika Revolt |
| 532–537 | Justinian builds the present Hagia Sophia |
| 27 December 537 | Inauguration as the cathedral of Constantinople |
| 558–562 | Dome partially collapses; rebuilt higher and steeper |
| 1204–1261 | Latin (Catholic) cathedral after the Fourth Crusade |
| 29 May 1453 | Mehmed II takes the city; converted to a mosque that week |
| 16th century | Sinan adds buttresses and two minarets |
| 1847–1849 | Fossati brothers’ restoration |
| 1 February 1935 | Opens as a museum |
| 1985 | UNESCO World Heritage listing |
| 24 July 2020 | Reopens for worship as the Hagia Sophia Grand Mosque |
| 15 January 2024 | Upper-gallery route introduced for foreign visitors |
How Old Is Hagia Sophia?
Counting from its inauguration in 537, Hagia Sophia is roughly 1,490 years old. Count from the site’s first church, dedicated in 360, and people have worshipped on this ground for more than 1,650 years. Few buildings anywhere have stayed in use so long, and none carry this many empires under one roof.
Seeing those layers stacked in person is the point of a visit: the omphalion and roundels from the gallery, Dandolo’s marker upstairs, the Theodosian stones outside. Our plan your visit page covers entrances and timing, and if your dates are set, you can book skip-the-line entry ahead and spend your time inside rather than in the queue.