Few buildings anywhere have lived as many lives as Hagia Sophia. It was begun as the greatest church in Christendom, stood for nine centuries as the cathedral of the Byzantine Empire, became a mosque under the Ottomans, spent nearly a century as a museum, and returned to a mosque in our own time. Through it all, the great dome has floated above Istanbul‘s skyline, surviving earthquakes, riots, conquests, and restorations. To understand Hagia Sophia is to understand the city itself, because every empire that ruled Constantinople left its mark on these walls. This guide traces the complete history of the building, from its first foundations to the monument you can walk into today.
The First Two Hagia Sophias
The story begins before Justinian. When Constantine the Great refounded Byzantium as Constantinople in 330, the city needed a great church, and the first Hagia Sophia, the church of Holy Wisdom, rose near the imperial palace in the following decades, completed under his son Constantius around 360.
That first church was built in timber-roofed basilica form, and it was the city’s cathedral, the seat of the patriarch and the setting for imperial ceremonies. It survived less than a century before riots burned it down in 404, during the exile of the patriarch John Chrysostom.
Theodosius II built the second church on the same site, inaugurated in 415, larger and more splendid, with a monumental porch. That building stood for more than a century, through the empire’s crises and recoveries, until January 532, when the Nika revolt turned Constantinople into a battlefield and the second Hagia Sophia burned to the ground.
The Nika Revolt and the Decision to Rebuild
The Nika revolt was the most dangerous moment of Justinian’s reign. In January 532, the city’s rival chariot-racing factions united against the emperor, and the uprising spread through Constantinople, with much of the center, including the church of Holy Wisdom, going up in flames.
Justinian nearly fled the city. According to the historian Procopius, it was his wife Theodora who steadied him, refusing to leave the capital. The revolt was crushed after days of violence, and the emperor emerged with a free hand to reshape the ruined city in his image.
The decision that followed defines Hagia Sophia. Justinian chose to rebuild the church on a scale never attempted, not a larger basilica but a dome-bearing structure unlike anything in the empire. The old church, he reportedly said, had not been good enough for God, and the new one would be worthy of Solomon.

Justinian’s Great Building Project
For the new church, Justinian summoned the two most brilliant engineers of the age: Anthemius of Tralles and Isidorus of Miletus, both from Asia Minor and both versed in mathematics as much as construction. Their design, a vast dome resting on pendentives over a square nave, was a leap into the unknown.
The construction was an imperial obsession. Materials came from across the Mediterranean, columns were brought from ancient temples, and a workforce of thousands labored for nearly six years. The dedication came in December 537, and the dome of the completed church soared higher than anything the ancient world had built.
Legend says Justinian, entering the completed church, cried out, Solomon, I have outdone thee. Whether or not the words are authentic, they capture the ambition. For almost a thousand years, Hagia Sophia was the largest cathedral on earth, and nothing like its dome had been attempted since Rome.
The Dome Collapses and Rises Again
The triumph did not last. In 558, just over two decades after the dedication, earthquakes cracked the great dome, and it collapsed, destroying the altar and much of the church. The disaster was a blow to the empire’s pride and to the building’s mystique.
The rebuilding fell to Isidorus the Younger, nephew of the original architect. He raised the new dome by some six meters, steepening its curve so that its weight pressed down more safely, and strengthened the supporting arches and piers. The reconstructed dome was dedicated in 562, and it is this dome, in its essentials, that still stands.
The lesson of the collapse shaped everything that followed. From then on, Hagia Sophia was a building in permanent dialogue with earthquakes, and the long history of its repair, by Byzantine and Ottoman builders alike, is the hidden story of the monument.

The Byzantine Centuries and the Great Mosaics
For the next nine centuries, Hagia Sophia was the spiritual heart of the Orthodox world. Emperors were crowned beneath its dome, patriarchs presided over its liturgy, and its mosaics, glowing in the half-light, taught the faith to a largely illiterate congregation.
The building suffered through the iconoclast centuries of the eighth and ninth centuries, when images were banned and its decorated surfaces were stripped, but the great mosaics that survive belong to the ages after the restoration of icons. The Virgin and Child in the apse, the imperial portraits, and the great Deesis mosaic of the Last Judgment date from the ninth to the thirteenth centuries.
These mosaics were not decoration but theology, images of Christ, the saints, and the emperors who ruled in his name. Their presence made Hagia Sophia a model for churches across the Orthodox world, and their recovery in the twentieth century revealed the building’s Byzantine soul.
The Latin Interlude
The Fourth Crusade, launched to recover Jerusalem, instead sacked Constantinople in 1204, and the Latin Crusaders ruled the city for nearly sixty years. Hagia Sophia, stripped of its treasures, was turned into a Latin cathedral, and its relics, gold, and icons were carried west.
The damage was enormous, and the Byzantine restoration of 1261 found a building that had been looted and neglected. The emperors of the restored empire, poorer and pressed by enemies, could only partly repair the church, and the mosaics they added reflect the melancholy of those final centuries.
By the mid-fifteenth century, Constantinople was a shrinking city, and Hagia Sophia, still the greatest church in Christendom, had become the symbol of an empire in its last decline. Its final Byzantine service took place on the eve of the Ottoman conquest in 1453.

The Ottoman Conquest and Conversion
On May 29, 1453, the Ottoman sultan Mehmed II entered Constantinople, and the story of Hagia Sophia turned. The sultan is said to have walked directly to the great church, and he ordered it converted into a mosque, adding a mihrab and a minbar and beginning the long transformation of the building.
The conversion was also a survival. The Ottomans revered the building, maintained it, and repaired it, and the great church that might otherwise have fallen into ruin was given a new life as the principal mosque of the imperial capital, the model for the great mosques that followed.
Over the centuries, the Ottomans added the elements that complete the silhouette we know: minarets, including the pair added by the great architect Sinan, buttresses, a mausoleum, and outbuildings. The mosaics, meanwhile, were covered, and the Byzantine church became, in layers, an Ottoman mosque.
Sinan and the Ottoman Restorations
The most important Ottoman chapter belongs to Mimar Sinan, the greatest architect of the empire. In the sixteenth century, under Sultans Selim II and Murad III, Sinan reinforced Hagia Sophia with massive external buttresses and added the two minarets that balanced the building’s profile.
Sinan’s intervention saved the building. The buttresses he designed to brace the dome system have carried its weight ever since, and his repairs after the earthquakes of the 1570s were the most thorough the structure had received since Byzantine times. He studied Hagia Sophia’s engineering closely, and it shaped his own dome designs at the great mosques of Istanbul.
The Ottoman centuries kept the building in constant use, and the additions of the period, the mihrab oriented toward Mecca, the sultan’s lodge, the great medallions bearing the names of God and the Prophet, and the madrasas and tombs of the complex, made Hagia Sophia an Ottoman monument layered over a Byzantine one.

The Museum Years
The Republic of Turkey, founded in 1923, inherited the building, and in 1935, under Atatürk’s government, Hagia Sophia was converted into a museum. The decision was revolutionary, opening the church-mosque to the world and beginning the recovery of its Byzantine mosaics.
The restoration of the museum years was painstaking. Plaster was removed, and the great mosaics, covered for four and a half centuries, re-emerged, glinting in the light, so that the building could finally be read as the work of both civilizations. For eighty-five years, Hagia Sophia was one of the most visited monuments on earth.
The museum decades also made Hagia Sophia a symbol of coexistence, a place where Christian and Muslim history stood side by side. Millions of visitors from every faith and none walked beneath the same dome, and the building’s power to hold contradictions became part of its meaning.
Hagia Sophia Today
In July 2020, Hagia Sophia was reconverted into a mosque, and it now functions again as a place of prayer, with entry free to visitors outside prayer times. The change returned the building to the role it held for nearly five centuries before the museum years.
Today the building holds both worlds at once. The great medallions and the mihrab orient the interior toward Mecca, while the restored mosaics of the Virgin and the emperors remain visible in the galleries, and the dome still gathers the light exactly as it did in 537.
For the visitor, Hagia Sophia is best understood as a palimpsest, a building that has been church, mosque, museum, and mosque again. Each layer is real, and the monument’s power lies in holding them together, one above the other, beneath a dome that has outlasted every empire that built it.
Frequently asked questions
How many times has Hagia Sophia been destroyed and rebuilt?
Three churches have stood on the site. The first, completed around 360, burned in 404; the second, built by Theodosius II in 415, burned during the Nika revolt of 532. The present building, Justinian’s church dedicated in 537, still stands, though its original dome collapsed in 558 and was rebuilt higher.
Why was Hagia Sophia converted into a mosque in 2020?
The building was converted back into a mosque by Turkish authorities in July 2020 after a court ruling annulled its museum status. The decision returned Hagia Sophia to the role it held from 1453 to 1935. It now serves as an active mosque, with free entry for visitors outside prayer times.
Was Hagia Sophia the largest church in the world?
Yes. From its completion in 537 until the completion of the cathedral of Seville in the sixteenth century, Hagia Sophia was the largest cathedral on earth, a record of nearly a thousand years. Its dome, more than a hundred feet across, remained the widest in the world for centuries.
All Over Information
The All Over Information editorial team researches and writes practical English-language guides to Turkey. Facts are checked against official and local sources before publication, prices are published as dated ranges rather than quotes, and guides are revised when things change. We accept no sponsored posts, paid placements or paid links.
More guides like this
Best Time to Visit Blue Mosque to Avoid Crowds
The Blue Mosque is one of the most visited buildings in the world, and its interior is not large.
Best Time to Visit Topkapi Palace to Avoid Crowds
Topkapi Palace is one of the most visited museums in the world, and its crowds are legendary: queues at the ticket gates,…
Anitkabir Through the Centuries
Anıtkabir is the youngest of the great monuments of Turkey — the mausoleum built in the twentieth century for the founder of…
Why Blue Mosque Should Be on Your Turkey Bucket List
Every Istanbul itinerary includes the Blue Mosque, and the clichés are all true.
Why Mevlana Museum Should Be on Your Turkey Bucket List
The Mevlana Museum of Konya — the tomb of the great mystic Rumi — is one of the most beloved monuments of…
Best Time to Visit Rumeli Fortress to Avoid Crowds
The Rumeli Fortress is one of the most visited monuments of the Bosphorus, and the crowds of the castle can be as…