Few buildings in the world carry as many layers of history as Hagia Sophia. The Byzantine emperor Justinian had it built in just five years, and it was consecrated in 537. For almost a thousand years it was the largest church in Christendom, with a dome that seemed to hang in mid-air and that changed religious architecture for good. After the Ottoman conquest of 1453 it became an imperial mosque and gained minarets, a mihrab and calligraphic roundels. In 1935 the secular Republic of Turkey turned it into a museum. It reopened for Muslim worship in 2020, and since 2024 tourists and worshippers have followed separate routes: one group prays on the ground floor while the other walks the upper gallery past thousand-year-old Byzantine mosaics.
That dual role, as an active place of worship and a monument visited by millions, is what makes going inside Hagia Sophia today so unusual. The same space holds the green prayer carpet, the huge Ottoman chandelier hanging beneath the dome, and roundels bearing the names of Allah and the Prophet Muhammad in seven-metre gold letters. On the walls and in the upper gallery are Byzantine mosaics of Christ, the Virgin and emperors that have survived centuries of earthquakes, looting and changes of regime. It is quite literally one empire layered on another: Byzantine, Ottoman and modern Turkish, each leaving its mark without fully erasing the one before.
This guide explains how to visit Hagia Sophia today: the separate entrance system in place since January 2024, how much it costs and what you can actually see from the gallery. Our history page then covers the building's full story, from the riot that destroyed the earlier basilica to the 2020 court ruling that returned it to worship. We give the exact dates there, without the date error that, ironically, appears on the monument's own official website.
Entramos en una escala de una noche: lo que vimos adentro, la línea que separa la zona de culto de la de visita y lo que cambió en el régimen de entrada después de nuestro viaje.
Read my full story →The building we see today is the third Hagia Sophia on the same site. The two earlier ones, built under Constantine and Theodosius II, were lost to fires and riots. Emperor Justinian had the current building raised between 532 and 537, after the Nika riots. It served as the cathedral of Constantinople and was the largest church in the Christian world for almost a thousand years. After the Ottoman conquest on 29 May 1453, Sultan Mehmed II turned it into a mosque, and later sultans added minarets, the mihrab, the minbar and the great calligraphic roundels. On 24 November 1934 Atatürk's government decreed its secularisation, and on 1 February 1935 it opened as a museum. Turkey's Council of State annulled that decree on 2 July 2020. Eight days later, on 10 July 2020, a presidential decree reopened Hagia Sophia for Muslim worship. Since 15 January 2024 a two-entrance system has also kept worshippers and tourists apart. The full story, with every date and its source, is on our history page.
Read the full history ↓If you only have one day, take a guided tour on the first one: it sets up the rest of your trip and saves you a lot of walking. We look ours up on Civitatis: guided in Spanish and booked online with no fuss. They have over 30 activities in Estambul. And there are free tours here: you book without paying and tip the guide whatever you think at the end, so trying one costs you nothing. Three are below so you get the idea: tap any of them and they all open.
They depart from Estambul, 0 km away. If you book from this link we earn a commission and you pay no more.
No exact prices: a scale from $ (budget) to $$$$$ (luxury), with 2-3 options per category.
Origins, formation and what the sources say.
Strictly speaking, the building we know today as Hagia Sophia is the third one built on the same site. The first 'Great Church' was commissioned by Constantine I, the emperor who made Constantinople the capital and Christianity the official religion. It was a basilica with a timber roof, and it was inaugurated in 360 under his son Constantius II. It burned to the ground in 404, during the unrest that followed the exile of the patriarch John Chrysostom.
A second basilica, also built of timber and also dedicated to 'Holy Wisdom' (that's what 'Hagia Sophia' means in Greek; it isn't the name of a female saint), was built by Theodosius II and inaugurated in 415. That second Hagia Sophia didn't survive either. It went up in flames in January 532, during the most violent episode of early Byzantine history, the Nika riots.
The Nika riots broke out in the Hippodrome of Constantinople. The two rival chariot-racing factions, the 'Blues' and the 'Greens', also stood for opposing political and social interests, but for once they joined forces against Emperor Justinian. They demanded the dismissal of his most unpopular officials and went as far as proclaiming a rival emperor. Over several days of rioting, much of central Constantinople was reduced to ashes, including the second Hagia Sophia. Justinian came close to fleeing the city, but the final crackdown, which left thousands of rioters dead in the Hippodrome, let him keep his throne. Paradoxically, it was this same uprising that cleared the ground, literally and politically, for the project Justinian had in mind: a Hagia Sophia far larger and more ambitious than the two before it.
The fire from the Nika riots had barely gone out when Justinian commissioned a third Hagia Sophia, unlike anything that had been built before. He put two men in charge of the project who weren't architects in the traditional sense but scientists: Anthemius of Tralles, a mathematician and expert in geometry and optics, and Isidore of Miletus, an engineer who specialised in physics applied to construction. The choice was no accident. The central challenge of the project was to roof a colossal space with a dome that seemed to float, and that was above all a problem of structural calculation.
Work began on 23 February 532 and was finished in an astonishingly short time for a building of its scale: five years and ten months, with the final consecration on 27 December 537. More than ten thousand workers are said to have worked on it at the same time, using materials brought from all over the Mediterranean. These included marble from Egypt and Anatolia and columns reused from older pagan temples (according to tradition, some came from the Temple of Artemis at Ephesus). The result was the largest enclosed building in the Christian world for almost a thousand years. It has a basilica-plan nave crowned by a central dome resting on pendentives. This solution solved, for the first time at that scale, the problem of placing a circular dome over a square plan.
Legend has it that when the work was finished, Justinian exclaimed 'Solomon, I have surpassed thee', a reference to the Temple in Jerusalem. The line is probably apocryphal, but it captures the real ambition of the project well. Hagia Sophia wasn't just a church. It was a statement of power by an emperor who ruled the eastern Mediterranean and hoped to win back the western half.
For almost a millennium, Hagia Sophia was the cathedral of Constantinople, the seat of the Ecumenical Patriarch and the setting for imperial coronations. But its Byzantine history was far from peaceful. The original dome was flatter than the current one. Earthquakes in 553 and 557 partly brought it down, and it collapsed again in 558. Isidore the Younger, nephew of one of the original architects, rebuilt it a few metres higher and with a different curvature, and that is essentially the dome that survives today. Another section of the dome and the eastern arch collapsed in 1346, after years of cracking, and had to be repaired once more.
The most traumatic blow, however, came not from nature but from fellow Christians. In 1204, during the Fourth Crusade, the Latin crusaders diverted their expedition, which in theory was bound for the Holy Land, and sacked Constantinople. Hagia Sophia was stripped of much of its treasure and many of its relics. During the Latin occupation that followed, until 1261, it served as a Catholic cathedral rather than an Orthodox one. The city regained its independence in 1261, but the Byzantine Empire never fully recovered from that blow. It entered a long, slow decline that would last two more centuries.
By the 15th century, the Byzantine Empire had shrunk to little more than Constantinople itself. Hagia Sophia had been damaged, patched up several times and had lost the wealth of its best days. Even so, it was still the most important religious symbol of the Orthodox world, and the symbolic prize that any conqueror of the city coveted.
On 29 May 1453, after weeks of siege, the troops of Sultan Mehmed II entered Constantinople and ended more than a thousand years of the Byzantine Empire. Ottoman accounts are quoted today even on the monument's official website. According to them, Mehmed himself, later known as 'Fatih' ('the Conqueror'), rode straight to Hagia Sophia as soon as he had taken the city. He found the basilica full of townspeople who had taken refuge there, fearing for their fate, and he guaranteed their lives and their freedom. He then ordered that the building be turned into a mosque, and he is said to have taken part in the first Muslim prayer held inside.
The conversion didn't mean destroying the building. Quite the opposite: from the very start, the Ottoman sultans saw it as a major symbol of the conquest and looked after it carefully. Mehmed II ordered the first minaret to be added, made of wood. He also entrusted the building's upkeep to a religious foundation (waqf) set up for the purpose, whose founding charter dates from 1462. Centuries later, that document became the legal basis used in the Turkish courts of the 21st century to argue that the building had to remain a mosque in perpetuity.
Over the following centuries, successive sultans added new elements: a second, brick minaret under Bayezid II, a mihrab and a minbar. Above all, there was the work of the great imperial architect Mimar Sinan. In the 16th century, under Selim II, he reinforced the structure with buttresses and built the first sultans' mausoleums (türbes) next to the building. His work ensured that Hagia Sophia, so often damaged in Byzantine times, would not suffer another major collapse despite Istanbul's frequent earthquakes.
After the First World War and the Ottoman defeat, Mustafa Kemal Atatürk founded the Republic of Turkey in 1923 and launched a radical, secularist reform of the new state. He abolished the sultanate and the caliphate, separated religion from government affairs and generally sought to reduce the symbolic weight of the Ottoman imperial past in public life. In that context, on 24 November 1934 the Turkish Council of Ministers issued a cabinet decree that ended Hagia Sophia's role as a working mosque. The decree turned it into a museum, open to all visitors regardless of religion.
The museum opened to the public on 1 February 1935, after several years of restoration work. Part of that work was the partial removal of the plaster that, during the Ottoman period, had covered many of the Byzantine mosaics with figurative religious scenes, which are forbidden in Islam. Recovering the mosaics, a job carried out by the Byzantine Institute of America among others, was one of the great contributions of the museum era. Thanks to it, works such as the Deësis mosaic and the mosaic of John II Komnenos and Irene could be seen again after centuries.
For 86 years, Hagia Sophia operated as a state museum, run first by the Ministry of Education and later by the Ministry of Culture and Tourism. It became one of the most visited sites in Turkey, with millions of tourists a year. The same period also saw the 'Historic Areas of Istanbul', which include Hagia Sophia, inscribed on the UNESCO World Heritage List in 1985.
On 2 July 2020, the Tenth Chamber of the Turkish Council of State, the country's highest administrative court, ruled unanimously that the 1934 cabinet decree was unlawful. The court found that it contradicted the 1462 founding charter of Mehmed the Conqueror's foundation, which established the building's use as a mosque in perpetuity. Eight days later, on 10 July 2020, President Recep Tayyip Erdoğan signed presidential decree no. 2729. The decree transferred the administration of Hagia Sophia to the Presidency of Religious Affairs (Diyanet) and reopened the building for Muslim worship. The first Friday prayer was held on 24 July 2020, with huge crowds and a live broadcast. The decision drew international criticism, including from UNESCO, which regretted not having been consulted beforehand despite the site's World Heritage status.
Here's a little-known detail worth pointing out. The monument's own official website, ayasofyacamii.gov.tr, gets the dates wrong on its history page. It states that 'the Council of State reversed the cabinet decree on 10 July 2020', mixing up the date of the court ruling with the date of the presidential decree that put it into effect. The same page exposes the contradiction. A few paragraphs further down, it reproduces presidential decree no. 2729 in full, and that text is accurate. It cites the ruling of the Tenth Chamber of the Council of State 'dated 2/7/2020' (Turkish day/month/year format), case no. E:2016/16015 and decision no. K:2020/2595, as the precedent that allowed the decree to be issued eight days later. In other words, the court ruling came on 2 July, and the presidential decree that reopened Hagia Sophia for worship came on 10 July. The official website's own narrative confuses the two dates, although the legal document it quotes sets the record straight.
After the 2020 reopening, Hagia Sophia operated for a few years with fairly open access for both worshippers and tourists. Then the authorities realised that the mixed flow was causing very long queues and friction between the two uses. Culture and Tourism Minister Mehmet Nuri Ersoy announced a solution in late October 2023, in response to a UNESCO recommendation, and it came into force on 15 January 2024. Since then, worshippers enter free of charge through the ground-floor prayer entrance. Tourists use a separate entrance under the minaret of Bayezid II and pay €25 per person to visit only the upper gallery. They leave by a different ramp and never cross the prayer area. This is the system in place today, and in practice it defines how Hagia Sophia is visited in the 21st century: a building that is still both an active mosque and one of the most visited monuments on the planet.