How prayer times are calculated

Every prayer time is a position of the Sun. Fajr, sunrise, Dhuhr, Asr, Maghrib and Isha each begin when the Sun reaches a particular angle relative to your horizon. This page shows the astronomy and the spherical geometry used to turn those angles into clock times, with a worked example recalculated every day.

By Dr. Muhammad Awais Yousaf, Associate Professor

What each prayer time means

Islamic prayer times are defined by what happens in the sky, so they can be calculated for any place on Earth once we know the Sun's position. Three angles do almost all the work: the observer's latitude φ, the Sun's declination δ (how far north or south of the equator it is overhead today), and thehour angle H (how far the Earth has turned since the Sun crossed the local meridian).

Astronomical definition of each time
TimeSky eventSun's altitude h
FajrTrue dawn: first light along the eastern horizon−15° to −19.5° (by method)
SunriseUpper edge of the Sun appears−0.833°
DhuhrSun crosses the meridian (highest point)maximum
AsrShadow reaches a set lengtharccot(k + tan|φ − δ|)
MaghribSunset: upper edge disappears−0.833°
IshaEvening twilight ends−15° to −18° (by method), or a fixed interval

Sunrise and sunset use −0.833° rather than 0° because the atmosphere bends sunlight by about 34′ at the horizon, and we see the Sun's upper edge, which is 16′ above its centre: 34′ + 16′ = 50′ = 0.833°.

Twilight angles: the Sun below the horizon at 0.833°, 12°, 15° and 18°ObserverSunrise / sunset: 0.833°12°: UOIF15°: ISNA18°: MWL, Karachi, Moonsightingsky above the horizonangles drawn to scale
The deeper the Sun is below the horizon, the darker the sky. A method's Fajr/Isha angle picks the moment dawn begins or dusk ends.

Step 1: where the Sun is today

We follow Jean Meeus, Astronomical Algorithms (2nd ed., 1998), the standard reference used by the adhan library that powers this site. First, count days on a continuous scale, the Julian Day (JD) for 0h UT on the date (year Y, month M, day D; January and February count as months 13 and 14 of the previous year):

JD=⌊365.25(Y+4716)⌋+⌊30.6001(M+1)⌋+D+B−1524.5

with B = 2 − ⌊Y/100⌋ + ⌊Y/400⌋. Time is then measured in Julian centuries since 1 January 2000, 12h:

T=JD−245154536525

From T we get the Sun's mean longitude L₀, its mean anomaly M (where it is on its elliptical orbit) and the equation of the centre C, which corrects for the orbit not being a circle:

L0=280.46646+36000.76983T+0.0003032T2 M=357.52911+35999.05029T−0.0001537T2 C=(1.914602−0.004817T)sinM+0.019993sin2M+0.000289sin3M

The Sun's apparent longitude along the ecliptic is λ = L₀ + C − 0.00569 − 0.00478 sin Ω (a small correction for aberration and nutation, Ω = 125.04 − 1934.136T). The Earth's axis is tilted by the obliquity ε ≈ 23.44°, and projecting the Sun's position onto the celestial equator gives its declination and right ascension:

δ=arcsin(sinε·sinλ)α=atan2(cosε·sinλ,cosλ)
Today's values (Sunday, 27 September 2026)
QuantitySymbolValue
Julian Day (0h UT)JD2461310.5
Julian centuries since J2000T0.26736482
Mean longitudeL₀185.8058°
Mean anomalyM262.4087°
Equation of the centreC-1.8910°
Apparent longitudeλ183.9116°
Obliquity of the eclipticε23.4380°
Declinationδ-1.5548°
Right ascensionα183.5897°
Apparent sidereal time at 0h UTΘ₀5.8022°

Step 2: solar noon and Dhuhr

The Sun crosses the local meridian when the Earth has rotated so that the local sidereal time equals the Sun's right ascension. For longitude L (east positive), the transit, as a fraction m of the UT day, is:

m0=α−L−Θ0360(mod 1),ttransit=24m0

For New York today (L = -74.00597°) that gives 16:47 UT. Dhuhr starts at transit; many methods add a minute or more so that the Sun's disc has fully passed the meridian. adhan then refines m by interpolating α and δ between yesterday, today and tomorrow, which moves the result by seconds.

Step 3: the hour-angle equation

In the spherical triangle formed by the celestial pole, the zenith and the Sun, the Sun's altitude his linked to latitude, declination and hour angle by the cosine rule of spherical trigonometry:

sinh=sinφsinδ+cosφcosδcosH

Solving for the hour angle at which the Sun reaches a chosen altitude h₀:

cosH=sinh0−sinφsinδcosφcosδ

The Earth turns 15° per hour, so the event happens H/15 hours before transit (morning) or after it (evening):

tFajr=ttransit−H(−αF)15tIsha=ttransit+H(−αI)15

Sunrise and Maghrib use h₀ = −0.833°. If the right-hand side is greater than 1 or less than −1 there is no solution: the Sun never gets that low (or high) that day. That is exactly what happens to Fajr and Isha in summer at high latitudes, covered below.

Step 4: Asr and the shadow rule

Asr is defined by shadows. At noon a vertical stick of length 1 casts a shadow of length tan|φ − δ|. Asr begins when the shadow has grown by k stick lengths beyond that: k = 1 for the Standard (Shafi, Maliki, Hanbali) opinion and k = 2 for the Hanafi opinion. A shadow of length smeans the Sun's altitude is arccot s, so:

hAsr=arccot(k+tan|φ−δ|)

That altitude goes into the hour-angle equation of Step 3 (afternoon side). In New York today,hAsr = 27.65° for Standard and 18.97° for Hanafi.

Asr shadow geometry: a stick of length 1, its noon shadow, and the Standard and Hanafi Asr shadows1noon shadow = tan|φ − δ|Standard (Asr): noon shadow + 1Hanafi (Asr): noon shadow + 2h
Asr starts when the shadow equals the noon shadow plus one stick length (Standard) or two (Hanafi), so Hanafi Asr is always later.

Step 5: from angles to your clock

Steps 2–4 give times in Universal Time. We convert them to local time with the IANA time-zone database (e.g. Europe/London, America/New_York), which knows every daylight-saving change, so a timetable crossing a clock change is correct on both sides. Finally each method may add fixed minutes (for example Moonsighting Committee adds 5 minutes to Dhuhr and 3 to Maghrib) and every time is rounded to the nearest minute.

New York is currently UTC−4, so transit at 16:47 UT is 12:47 local time.

Worked example: New York today

Sunday, 27 September 2026, latitude φ = 40.71427°, longitude -74.00597°, ISNA method (Fajr and Isha at 15°), Standard Asr, declination δ = -1.555°. The "formula" column applies Steps 2–4 directly; the "published" column is what the New York City page shows after adhan's refinements, method adjustment and rounding.

New York, Sunday, 27 September 2026
TimeDefinitionHour angle HFormula (UT)Formula (local)Published
FajrSun 15° below the horizon, before transit108.556°09:33 UT05:3205:33
SunriseUpper limb on the horizon (h₀ = −0.833°)89.761°10:48 UT06:4806:49
DhuhrSolar transit +1 min (ISNA)0°16:47 UT12:4712:48
AsrShadow = noon shadow + 1× length (h = 27.65°)50.521°20:09 UT16:0916:07
MaghribSunset (h₀ = −0.833°)89.761°22:46 UT18:4618:45
IshaSun 15° below the horizon, after transit108.556°00:01 UT20:0120:00

The two columns agree to within about two minutes. The small differences are the refinement step: the simple formula uses the Sun's position at 0h UT, while adhan recomputes the declination and right ascension at the moment of each event (interpolating between yesterday, today and tomorrow) and then applies the method's fixed adjustments and rounding. A unit test in the project checks the agreement every build.

Calculation methods compared

Authorities differ mainly in the twilight angles chosen for Fajr and Isha, which come from different observations of when dawn begins and dusk ends. Our defaults: United Kingdom: Moonsighting Committee; United States: ISNA (North America); Canada: ISNA (North America); Australia: Muslim World League.

Parameters by method
MethodFajrIshaFixed adjustments
Muslim World League18°17°Dhuhr +1 min
ISNA (North America)15°15°Dhuhr +1 min
Moonsighting Committee18° with seasonal limit18° with seasonal limitDhuhr +5, Maghrib +3 min
Egyptian General Authority19.5°17.5°Dhuhr +1 min
Karachi18°18°Dhuhr +1 min
Umm al-Qura18.5°90 min after Maghrib—
Dubai18.2°18.2°Sunrise −3, Dhuhr/Asr/Maghrib +3 min
Kuwait18°17.5°—
Qatar18°90 min after Maghrib—
Singapore (MUIS)20°18°Dhuhr +1 min, rounded up
Tehran17.7°14°Maghrib at 4.5°
Diyanet (Turkey)18°17°Sunrise −7, Dhuhr +5, Asr +4, Maghrib +7 min
UOIF (France)12°12°—

High latitudes

In summer at high latitudes the Sun never sinks 15–18° below the horizon, so the hour-angle equation for Fajr and Isha has no solution, or gives an impractical time. Every method therefore limits Fajr and Isha by a share of the night N, the time from sunset to the next sunrise:

tFajr≥tsunrise−pNtIsha≤tsunset+pN
  • Seventh of the night, p = 1/7. We use this above 48° latitude.
  • Middle of the night, p = 1/2. We use this below 48°, where it only matters in rare cases.
  • Moonsighting Committee (the UK default) uses its own seasonal limit instead: a number of minutes before sunrise (Fajr) or after sunset (Isha) that depends on latitude and on the days since the winter solstice. For Fajr the limit moves linearly between four values,a = 75 + 28.65·|φ|/55, b = 75 + 19.44·|φ|/55, c = 75 + 32.74·|φ|/55 and d = 75 + 48.1·|φ|/55 minutes, over the seasons. Above 55° latitude it switches to one-seventh of the night.

London (51.5° N) on 21 June is the classic case: at 18° there would be no Fajr or Isha at all, but the seasonal limit gives valid times, which the site's tests check every build.

The qibla: spherical geometry

The qibla is the direction of the Kaaba in Makkah (21.4225° N, 39.8262° E) along the shortest path over the Earth's surface, a great circle. It is not the straight line on a flat map, which is why the qibla from North America points north-east rather than south-east.

Spherical triangle between the North Pole, the observer and the KaabaN (North Pole)You (φ, L)Kaaba (φK, LK)90° − φ90° − φKΔLqgreat circle
The pole, your position and the Kaaba form a spherical triangle. The angle q at your corner, measured from north, is the qibla.

Applying the four-part formula of spherical trigonometry to that triangle, with ΔL = LK − L:

q=atan2(sinΔL,cosφ·tanφK−sinφ·cosΔL)

London example (φ = 51.50853°, L = -0.12574°): ΔL = 39.9519°, numerator sin ΔL = 0.64214, denominator = -0.35581, so q = atan2(0.64214, -0.35581) = 118.99°, a little south of east (ESE). See the London qibla page.

The distance uses the haversine formula with Earth's mean radius R = 6,371 km:

d=2Rarcsinsin2Δφ2+cosφ1cosφ2sin2ΔL2

For London, d = 4,794 km. The line drawn on our qibla maps is the same great circle, plotted by interpolating points along it with spherical linear interpolation. Phone compasses measure magnetic north; the qibla bearing is from true north, and most phones convert automatically.

The Hijri date

Hijri dates on this site use the Umm al-Qura calendar of Saudi Arabia, a calculated lunar calendar. Months begin based on the astronomical new moon and moonset, so local moon sighting can start a month a day later. That is why Ramadan and Eid dates here are marked "expected, subject to moon sighting".

Sources

  • Jean Meeus, Astronomical Algorithms, 2nd edition, Willmann-Bell, 1998 (chapters 7, 12, 15, 22, 25).
  • adhan-js: the open-source (MIT) library that computes every time on this site.
  • Khalid Shaukat, Moonsighting Committee Worldwide: seasonal Fajr and Isha limits for high latitudes.
  • City coordinates and time zones: GeoNames (CC BY 4.0); time-zone rules: IANA tz database.

Questions or corrections: awais.yousaf@iub.edu.pk. See also our About page and Disclaimer.

Quick answers

How is Fajr time calculated?

Fajr begins when the Sun is a fixed angle below the eastern horizon before sunrise: 15° for ISNA, 18° for the Muslim World League and Karachi, 18.5° for Umm al-Qura and 19.5° for the Egyptian method. The time is found by solving the hour-angle equation cos H = (sin h − sin φ sin δ) / (cos φ cos δ) for that angle.

How is Asr time calculated?

Asr begins when an object's shadow equals its noon shadow plus once its length (Standard: Shafi, Maliki, Hanbali) or twice its length (Hanafi). The Sun's altitude at that moment is arccot(k + tan|φ − δ|), with k = 1 or 2.

How is the qibla direction calculated?

The qibla is the initial great-circle bearing from your location to the Kaaba (21.4225° N, 39.8262° E): q = atan2(sin ΔL, cos φ · tan φK − sin φ · cos ΔL), measured clockwise from true north.