Long before a mosque had a clock on its wall, the times of prayer were tied to things anyone could see: the length of a shadow during the day and the light and dark of twilight at its two ends. Turning those signs into reliable times, in every season and every city, became one of the largest practical problems medieval astronomers worked on. The historian of science David A. King, whose surveys of the surviving manuscripts this article leans on, opened one survey by arguing that in Islam, more than in any other religion, ritual practice has been assisted by scientific procedures (King, Science in the Service of Religion).
Times set by shadows and twilight
In the definitions King describes, the daytime prayers are set by shadows and the night prayers by twilight, so the times depend on how far north or south a place lies (King):
- The middle of the day. At noon the shadow of an upright object is at its shortest. In some medieval circles, King notes, the Dhuhr prayer was taken to begin when the shadow had grown past that minimum by a quarter of the object’s length.
- The afternoon. Asr begins when the shadow has grown beyond its midday minimum by the length of the object itself. In some circles, King adds, the time of Asr lasted until the increase was twice the object’s length. Today a later reckoning that begins Asr at twice the length is also followed; this site’s page on how prayer times are calculated gives both and where each is the app’s starting setting.
- Sunset, nightfall and daybreak. Maghrib is tied to sunset, Isha to nightfall and Fajr to daybreak, all read from the sky rather than from a shadow.
None of this needs a clock. It needs a straight stick, level ground and a way to measure. What it does need is knowledge of the noon shadow, because the afternoon threshold is measured from it, and the noon shadow changes through the year and from place to place.
Reading a shadow
The geometry is simple enough to work through. Stand a rod of length 1 upright. At noon the sun stands at an altitude of 90 degrees less the difference between the place’s latitude and the sun’s declination, its angle north or south of the equator, which swings through the year between about 23.44 degrees north and south because of the tilt of the Earth’s axis (NASA, Earth Fact Sheet). The noon shadow is the rod’s length divided by the tangent of that altitude.
At Damascus, latitude 33.5 degrees, on the day of an equinox the noon sun is 56.5 degrees high and the shadow of the rod is 0.66 units long. The earlier Asr waits for 1.66 units, the noon shadow plus one rod, when the sun has sunk to 31.0 degrees; the later reckoning waits for 2.66 units, with the sun at 20.6 degrees (all calculated). In June the Damascus noon shadow shrinks to 0.18; in December it stretches to 1.54. In London in December it is already 3.72 units at noon, and Asr begins when the shadow reaches 4.72.
Shadow of a rod 1 unit tall, at noon and at the start of Asr calculated
| Place and day | Noon shadow | Earlier Asr shadow | Later Asr shadow | Sun at earlier Asr |
|---|---|---|---|---|
| MakkahJune solstice | 0.04 | 1.04 | 2.04 | 44.0 degrees |
| Makkah, March or September equinox | 0.39 | 1.39 | 2.39 | 35.7 degrees |
| Makkah, December solstice | 1.00 | 2.00 | 3.00 | 26.6 degrees |
| CairoJune solstice | 0.12 | 1.12 | 2.12 | 41.9 degrees |
| Cairo, March or September equinox | 0.58 | 1.58 | 2.58 | 32.3 degrees |
| Cairo, December solstice | 1.35 | 2.35 | 3.35 | 23.0 degrees |
| DamascusJune solstice | 0.18 | 1.18 | 2.18 | 40.3 degrees |
| Damascus, March or September equinox | 0.66 | 1.66 | 2.66 | 31.0 degrees |
| Damascus, December solstice | 1.54 | 2.54 | 3.54 | 21.5 degrees |
| LondonJune solstice | 0.53 | 1.53 | 2.53 | 33.1 degrees |
| London, March or September equinox | 1.26 | 2.26 | 3.26 | 23.9 degrees |
| London, December solstice | 3.72 | 4.72 | 5.72 | 12.0 degrees |
Calculated from each city's latitude in this site's city list and the sun's declination on the three days (23.44 degrees north, 0, 23.44 degrees south). At Makkah in June the noon sun stands a little north of overhead, so its short noon shadow points south. The times these shadows give on any day are on each city's prayer times page; how the site calculates them is on how prayer times are calculated.
Folk astronomy and the muezzin
For most of history most people did not compute anything. King distinguishes two traditions: a folk astronomy of naked eye observation with no theory and no computation, and a mathematical astronomy built on observation, theory and calculation. The folk tradition, he writes, was far more influential in society, while the mathematical solutions were too complicated for wide use; the legal scholars, who had far more say over how people practised, applied the simple folk techniques (King).
The muezzin who gave the call to prayer was, in King’s account, chosen for piety and the quality of his voice, and his technical knowledge was limited to the basics of folk astronomy (King).
Tables for a whole city
The mathematical tradition turned the definitions into tables. King reports that the earliest prayer tables were computed for Baghdad by al-Khwarizmi in the ninth century, and that tables giving the time of day from the altitude of the sun, or of stars at night, followed in the ninth and tenth centuries (King).
The most famous set is linked with Cairo. Ibn Yunus, who died in Egypt in 1009 and witnessed the founding of Cairo, is associated with a corpus of tables for timekeeping that was used in Cairo until the 19th century, though some of its tables were added in the 13th and 14th centuries (King, Ibn Yunus). The corpus runs to about 200 pages, most tables with 180 entries. The main tables give, for every degree of the sun’s altitude and every degree of its position in the zodiac, the time since sunrise, the time remaining to midday and the sun’s direction, each set holding over 10,000 entries, all computed for the latitude of Cairo, 30 degrees. Other tables give functions used to find the five daily prayers.
The design explains the point of the work: with such a book, a timekeeper who had measured the sun’s altitude and knew its place in the zodiac for the date could read the time off the page instead of doing the trigonometry himself.
The muwaqqit
From the 13th century, King writes, mosques and religious colleges began to employ a professional astronomer, the muwaqqit, who regulated the times of prayer, made instruments, wrote treatises and taught students. He places the decisive development in 13th century Cairo, whose new tables set the pattern for astronomical timekeeping across the Islamic world, and names Damascus, Tunis, Taiz, Jerusalem, Mecca, Edirne and Istanbul among the centres, with Istanbul the main one by the 16th century (King).
Damascus in the 14th century had two of the best known. Ibn al-Shatir, born in Damascus around 1305 and died there around 1375, was head muwaqqit at the Umayyad Mosque; King calls him the most distinguished Muslim astronomer of his century. He compiled tables of the twilight durations and the time of the afternoon prayer for a latitude of 34 degrees (King, Ibn al-Shatir). His colleague al-Khalili, active around 1365, produced a set of tables for solar timekeeping and prayer times at the latitude of Damascus, with auxiliary tables that work for any latitude; some were used in Damascus into the 19th century and for centuries in Cairo and Istanbul (King, Khalili).
Astrolabes and quadrants
The instruments of the trade were above all the astrolabe and the quadrant, the two most popular according to King (King). With an astrolabe one sights the sun or a star to measure its altitude, sets the instrument’s map of the sky against the horizon lines for the latitude, and reads the time where the rule crosses the scale on the rim (Museum of the History of Science, Using the astrolabe). The History of Science Museum in Oxford notes that the astrolabe could find the five times of prayer and the direction of Makkah, and that it was adapted most specifically to Islamic practice (Museum of the History of Science, Faith).
Three of the museum’s instruments show how:
- Lahore, about 1650. An astrolabe by Muhammad Muqim carries curved lines on its back that give the beginning and end of the afternoon prayer, and inside it a gazetteer of the longitude and latitude of 77 places (Times of prayer, Inv. 37530).
- Toledo, 1068. A plate by Ibrahim ibn Said al-Sahli is engraved for Makkah and Yamama at latitude 21 degrees 40 minutes and carries lines for finding the times of prayer (The sacred city, Inv. 55331).
- North Africa, 1733 or 1734. An astrolabe by Muhammad ibn Ahmad al-Battuti is inscribed as a gift to a mosque in Fez, and holds a perpetual calendar for both the Muslim and the Christian years (Gift to a mosque, Inv. 51459).
Sundials on mosques
The simplest instrument of all is a sundial, and King notes that many survive on mosques, though most no longer work (King). The finest known is Ibn al-Shatir’s. On the northern minaret of the Umayyad Mosque in Damascus he set a horizontal marble sundial about 2 metres by 1 metre, engraved with curves from which the muwaqqit could read the time in equal hours since sunrise or before sunset, relative to midday or to the afternoon prayer, and relative to daybreak and nightfall. Its gnomon points to the celestial pole, an arrangement King notes is usually credited to European astronomers. The dial on the minaret today is an exact copy made in the late 19th century; fragments of the original are kept in the garden of the National Museum in Damascus (King, Ibn al-Shatir).
Ibn al-Shatir also made something small enough to carry: a compendium of about 12 by 12 by 3 centimetres, preserved in Aleppo, that could find the times of the midday and afternoon prayers, fix the local meridian and point towards Makkah (King, Ibn al-Shatir).
What the record leaves open
Most of what is known comes from manuscripts and instruments that happen to survive, and much of the modern account comes from King’s own research; his survey notes that about 200 pages of Cairo tables were discovered only in 1970 (King). How much of this expert work reached ordinary mosques is harder to say; King himself stresses that folk methods remained far more widespread than tables. Dating is uncertain too: the Cairo corpus bears Ibn Yunus’s name, but King notes he may not have computed every table in it (King, Ibn Yunus).
What carried through is the definition. The prayer times on this site are still worked out from the sun’s position, by the angles and shadow lengths the methods name; only the arithmetic has moved from a book of tables to a few lines of code.
Sources
Each source below is listed with the date it was read. Links in the text go to the page that supports the sentence. Figures marked calculated are worked out by this site's own code each time the site is built, from the rules the sources give.
- David A. King, "Science in the Service of Religion: The Case of Islam", Impact of Science on Society 40 no. 3 (UNESCO, 1990), pp. 245 to 262; extract republished with the author's permission by Muslim Heritage, 2021 Read 3 December 2026.
- David A. King, "Ibn al-Shatir", in Thomas Hockey et al. (eds.), The Biographical Encyclopedia of Astronomers (Springer, 2007), pp. 569 to 570. Online at McGill University's Institute of Islamic Studies Read 3 December 2026.
- David A. King, "Ibn Yunus", in The Biographical Encyclopedia of Astronomers (Springer, 2007), pp. 573 to 574. Online at McGill University Read 3 December 2026.
- David A. King, "Khalili", in The Biographical Encyclopedia of Astronomers (Springer, 2007), pp. 625 to 626. Online at McGill University Read 3 December 2026.
- Museum of the History of Science, Oxford (now the History of Science Museum), The Astrolabe, East and West: Faith Read 3 December 2026.
- Museum of the History of Science, Oxford, The Astrolabe, East and West: Times of prayer (astrolabe by Muhammad Muqim, Lahore, about 1650, Inv. 37530) Read 3 December 2026.
- Museum of the History of Science, Oxford, The Astrolabe, East and West: The sacred city (astrolabe plate by Ibrahim ibn Said al-Sahli, Toledo, 1068, Inv. 55331) Read 3 December 2026.
- Museum of the History of Science, Oxford, The Astrolabe, East and West: Gift to a mosque (astrolabe by Muhammad ibn Ahmad al-Battuti, 1733 or 1734, Inv. 51459) Read 3 December 2026.
- Museum of the History of Science, Oxford, Using the astrolabe (student project pages) Read 3 December 2026.
- NASA Goddard Space Flight Center, National Space Science Data Center, Earth Fact Sheet (obliquity to orbit) Read 3 December 2026.
This article is history, drawn from the academic and historical record and published by the makers of Prayer Times & Quran Plus. It is not religious guidance, and it does not rule between schools or traditions. Corrections are welcome at support.