Prayer · Zenith

How are prayer times calculated

Prayer times are calculated from the sun's position at your latitude and longitude. Dhuhr is solar noon, Asr is when an object's shadow equals its height plus the noon shadow, Maghrib is sunset, and Fajr and Isha are when the sun sits a set angle below the horizon, typically 15 to 20 degrees depending on the convention used.

Updated 2026-09-13

The five times and what defines each one

Each prayer time is tied to an observable position of the sun, and the calculation simply predicts when the sun reaches that position at your location. Dhuhr begins when the sun passes its highest point in the sky, which astronomers call solar noon. Asr begins in the afternoon when shadows have lengthened by a defined amount. Maghrib begins at sunset. Isha begins when the evening twilight has faded, and Fajr begins when the first light of dawn appears in the east.

Solar noon is rarely 12:00 on the clock. The PrayTimes documentation gives the formula Dhuhr = 12 + TimeZone minus Longitude divided by 15 minus the Equation of Time. The longitude term corrects for your position inside your time zone, and the equation of time corrects for the fact that the earth's orbit is not a perfect circle, which shifts solar noon by several minutes either way over the year.

Every other time is then measured relative to that noon. Sunrise and sunset are the moments the sun's upper edge touches the horizon, which PrayTimes models as the centre of the sun being 0.833 degrees below the horizon to account for the sun's radius and atmospheric refraction. This is why the app value for sunrise is a little earlier, and sunset a little later, than the purely geometric moment.

Asr and the shadow rule

Asr is defined by shadow length rather than a twilight angle. According to PrayTimes, most schools of law set Asr at the moment the shadow of an object equals the object's own height plus whatever shadow it cast at noon, which is a shadow factor of 1. The Hanafi school uses a factor of 2, meaning the shadow must reach twice the object's height plus the noon shadow, so Hanafi Asr is later in the day.

In practice the calculation converts the shadow factor into a sun altitude and then finds the time after noon when the sun drops to that altitude. In summer the sun is high at noon and the noon shadow is short, so Asr falls later in the afternoon; in winter it falls earlier. This is why the gap between Dhuhr and Asr changes through the year even though the rule itself does not.

Maghrib is usually taken as sunset. PrayTimes notes that many authorities add a delay of 1 to 3 minutes after the calculated sunset as a precaution, and that some Shia authorities instead use a twilight angle of about 4 degrees, which places Maghrib a few minutes after the sun has gone down.

Fajr and Isha: why the angle matters

Fajr and Isha are the two times that differ between apps and mosques, because they depend on a chosen twilight angle. Fajr is calculated as the moment before sunrise when the centre of the sun is a certain number of degrees below the horizon, and Isha as the matching moment after sunset. Astronomers define astronomical twilight as the period when the sun is between 12 and 18 degrees below the horizon, so 18 degrees is the point at which the sky is fully dark.

PrayTimes lists the conventions used by the main authorities. The Muslim World League uses 18 degrees for Fajr and 17 for Isha. The Islamic Society of North America uses 15 and 15. The Egyptian General Authority of Survey uses 19.5 and 17.5. The University of Islamic Sciences, Karachi uses 18 and 18. Umm al Qura University in Makkah uses 18.5 degrees for Fajr and sets Isha at a fixed 90 minutes after Maghrib rather than an angle, and the Gulf region method uses 19.5 degrees with the same 90 minute Isha.

The Fiqh Council of North America has published its own review of the question. It reports observations showing that true dawn appears at angles anywhere between 12 and 18 degrees depending on season, latitude, altitude and local obstructions, and recommends 15 degrees as a practical middle value while encouraging people to adjust based on their own local observation.

The difference is not academic. The Fiqh Council gives Anaheim, California as an example where a 20 degree angle yields a Fajr of 4:01 AM and a 12 degree angle yields 4:49 AM, almost an hour apart, and notes that in Vancouver the spread approaches two hours. If your app and your local mosque disagree by half an hour on Fajr, the angle setting is almost always the reason.

High latitudes where twilight never ends

In summer at high latitudes the sun never gets 18 degrees below the horizon, so the twilight formula has no solution and Fajr and Isha cannot be computed directly. This affects much of northern Europe and Canada for weeks around the June solstice.

PrayTimes documents three standard workarounds. The middle of the night method splits the interval from sunset to sunrise in half and places Isha and Fajr at that midpoint. The one seventh method divides the night into seven parts, placing Isha one seventh after sunset and Fajr one seventh before sunrise. The angle based method divides the night in proportion to the twilight angle, so with an 18 degree convention Isha falls at 18 divided by 60 of the night after sunset.

Apps that offer these as settings are not being vague. The rules they encode are the same ones national bodies use for published timetables in those regions, and the choice is usually made by the local community rather than the individual.

Doing the calculation on a phone

All of the above needs only four inputs: latitude, longitude, the date and the time zone. From the date the software computes the sun's declination and the equation of time. From latitude and the chosen angle it solves for the hour angle at which the sun reaches that altitude, then converts to local clock time. The maths is a handful of trigonometric formulas and takes a fraction of a millisecond, which is why it can run entirely offline.

Because the inputs are so few, a well designed prayer app has no need to send your location anywhere. Zenith, for instance, computes all five times on the device from the published angle conventions and makes no network requests, so the calculation method is a local setting rather than a server response.

When you set an app up, pick the convention that matches your mosque or national authority first, then the Asr school, then the high latitude rule if you live far enough north or south for twilight to persist all night in summer. If the times still differ from the local timetable by a minute or two, that is usually a deliberate safety margin added by the timetable, not an error in the calculation.

Frequently asked questions

Why do two apps show different Fajr times for the same city

Almost always because they use different twilight angles. An 18 degree convention places Fajr earlier than a 15 degree one, and the gap can be half an hour or more at mid latitudes. Check the calculation method setting in each app.

Which calculation method should I use

Use the method your local mosque or national authority follows. Common choices are the Muslim World League at 18 and 17 degrees, ISNA at 15 and 15, the Egyptian authority at 19.5 and 17.5, and Umm al Qura at 18.5 degrees with Isha 90 minutes after Maghrib.

What is the difference between standard and Hanafi Asr

Standard Asr uses a shadow factor of 1, when an object's shadow equals its height plus the noon shadow. Hanafi Asr uses a factor of 2, so the shadow must reach twice the object's height, which makes Asr later in the day.

Do prayer times need an internet connection

No. The calculation needs only latitude, longitude, date and time zone, so it can run entirely on the phone. An internet connection is only needed if an app chooses to download timetables instead of calculating them.

Why is Maghrib a couple of minutes after the sunset time shown in weather apps

Many authorities add a precautionary delay of 1 to 3 minutes after the calculated sunset. Some also model sunset with a slightly different angle. A small difference here is normal.

Sources