Islamic Prayer Times

What time is Maghrib? A question often followed by reaching for your smartphone. Muslims generally rely on an app on their smartphone or computer to know when it is time to pray. Most prayer time apps require the user to choose various settings in order to obtain the correct prayer times, specifically madhab and calculation method. Guidance will automatically choose defaults it thinks are correct for your location, but still contains these settings in case the defaults are not correct. So what are these settings and how do they affect prayer times? To better understand them, let’s take a look at where prayer times come from.

Sunrise, Dhuhr, and Maghrib

Most apps will display the times for the five daily prayers (Fajr, Dhuhr, Asr, Maghrib, and Isha) as well as the time for sunrise (sometimes called Shuruq) to indicate when the time for Fajr has ended. Of these times, sunrise, Dhuhr and Maghrib do not change based on any settings. Sunrise is defined as when the sun begins to appear over the horizon. Dhuhr is when the sun begins to decline after having reached its highest point (midday). And Maghrib is when the sun has completely disappeared beneath the horizon. While some methods may add an additional minute or two as a precaution, you should not generally see any significant variation in these times.


Asr can be calculated in two different ways based on which madhab (school of thought) you follow. The Shafi, Malaki, and Hanbali madhabs define the time for Asr as when the shadow of an object is the same length as the object itself plus the shadow length at midday. However, the Hanafi madhab defines the time for Asr as when the shadow of an object is twice the length of the object itself plus the shadow length at midday. In practice, the Hanafi Asr time is about 45 minutes to an hour later than the other Asr time. Both opinions are Islamically valid, so whichever setting you choose for Asr can be considered correct.

Fajr and Isha

Fajr and Isha take place when the sun is not visible. They are determined by the presence of twilight, the light from the sun when it is below the horizon. The time for Fajr begins at what is called true dawn (alfajr alsadiq), which occurs when the morning twilight spreads across the sky and fills the horizon. The time for Isha begins when the evening twilight (shafaq) in the sky has disappeared.

Twilight’s darkest point (when there is the least amount of light in the sky) is called astronomical twilight, which occurs in the morning when the sun is 18 degrees below the horizon until the sun rises and in the evening when the sun sets until it drops to 18 degrees below the horizon. However, at some locations, astronomical twilight does not exactly coincide with alfajr alsadiq and shafaq. And for locations above 48.5 degrees latitude (such as the UK and northern Europe), the sun never falls below 18 degrees and twilight doesn’t actually end. To compensate for these issues, the different calculation method settings offer alternative degrees for the sun’s position to determine morning and evening twilight.

Remote Locations

At latitudes of 55 degrees and higher, it no longer makes sense to calculate the sun’s position to determine Fajr and Isha as any such calculation would produce unreasonable times. For these locations, scholars recommend estimating the times for Fajr and Isha to prevent undue hardship. Fajr and Isha can be estimated by dividing the time between sunset and sunrise into seven parts. The time for Isha would be at the end of the first part and Fajr at the beginning of the last part.

Small Variations in Time

Sometimes people notice that prayer times from their smartphone are not exactly the same as the prayer times posted at a local masjid or published on a website. There can be many reasons for this difference. Smartphones using a GPS provide prayer times for your precise location, while websites usually calculate times for the center of a particular city. This can cause a noticable difference in large cities. Additionally, the ways in which calculations are rounded can also cause variations in prayer times. These small differences do not mean that one prayer time is valid or the other is invalid. Before the use of computers, prayer times were only determined by observing the sky, a method which does not allow for exact precision. While it is important to strive to be as accurate as possible when performing our prayers, variations of only a few minutes should not be a cause for concern.

Source Code

If you are interested in the code Guidance uses to generate prayer times, we have made it available as an open source project. You can also see the library it uses for calculations, the ITL Project.