In the place of the bassilica which burned down in 532 this church was built by Byzantine Emperor Justinianus, and was opened to service in 537. The architects were Antemius and Isidoros.
It was restored many times over the years. The biggest restoration was made by Mimar Sinan. When Istanbul was conquered in 1453, it was converted into a mosque. Different Sultans had four minarets added to the structure. It was made a museum in 1934. The building which is famous for its mosaics is covered by a dome 55.60 m high and 30.80 - 31.88 m in diameter, with 40 frame timbers. 107 pillars, 40 on the ground floor, 67 on the upper floor, support the building.