Prayer times widget for your website
Accurate salah times, the Hijri date and a live countdown to the next prayer. One line of code, any website, free forever.
Live preview
This is the real widget, rendered from the settings on the right. It updates every second and rolls over at midnight in your chosen timezone.
Configure
Paste it where you want the card to appear: a page, a sidebar, a footer, a WordPress Custom HTML block, Squarespace or Wix code block, or any CMS that accepts HTML.
For mosques and community sites
Most prayer-time widgets come with advertising, third-party trackers, or a monthly fee once your site grows. This one is different. Niyyara is a free worship app that does not monetize worship, and this widget follows the same rule.
Options
Every option is a data- attribute on the script tag. Only data-lat and data-lng are required.
| Attribute | Values | Notes |
|---|---|---|
data-lat, data-lng | decimal degrees | Required. Use your building's coordinates for the most accurate times. |
data-tz | IANA zone, e.g. America/Toronto | Recommended. If omitted, the visitor's browser timezone is used, which is usually right for a local mosque site. |
data-method | MuslimWorldLeague (default), NorthAmerica or ISNA, Egyptian, Karachi, UmmAlQura, Dubai, Kuwait, Qatar, Singapore, Turkey, Tehran, MoonsightingCommittee | Pick the convention your community follows. North America usually uses ISNA; South Asia usually Karachi; the Gulf its national method. |
data-madhab | shafi (default), hanafi | Only affects Asr. |
data-theme | light (default), dark, auto | auto follows the visitor's system setting. |
data-lang | en, ar, ur, hi, bn, id, ms, tr, fr, fa | Prayer names and dates are localized. Defaults to the page language, then English. |
data-clock | 12, 24 | Force a clock style. By default the language's own convention is used. |
data-title | text | Replaces the "Prayer Times" heading, for example with your masjid's name. |
data-width | full | By default the card is at most 400px wide and fluid below that. full lets it fill its container. |
Prayer times API
The widget is powered by a small public JSON API you are welcome to use directly, for example to print a monthly timetable or to feed a display screen in the prayer hall. No key needed. Please cache responses (they are already served with a 5 minute cache header) and keep traffic reasonable.
GET https://niyyara.com/api/prayer/times?lat=43.65&lng=-79.38&tz=America/Toronto&method=ISNA&madhab=shafi&date=2026-09-13
| Parameter | Notes |
|---|---|
lat, lng | Required. Decimal degrees, validated to the normal ranges. |
tz | Required. An IANA timezone name. The API does not guess the zone from coordinates (that needs a large boundary database), so send it explicitly. |
method, madhab | Same values as the widget. Friendly aliases such as ISNA, MWL and Makkah are accepted. |
date | YYYY-MM-DD in that timezone. Defaults to today. |
Response (abridged):
{
"date": "2026-09-13", "timezone": "America/Toronto",
"hijri": { "day": 2, "month": 4, "year": 1448, "monthName": "Rabiʻ II", "text": "2 Rabiʻ II 1448 AH" },
"method": "NorthAmerica", "methodLabel": "ISNA (North America)", "madhab": "shafi",
"times": { "fajr": "2026-09-13T09:34:00.000Z", "sunrise": "...", "dhuhr": "...", "asr": "...", "maghrib": "...", "isha": "..." },
"local": { "fajr": "05:34", "sunrise": "06:55", "dhuhr": "13:14", "asr": "16:44", "maghrib": "19:31", "isha": "20:52" },
"tomorrow": { "fajr": "2026-09-14T09:35:00.000Z", "fajrLocal": "05:35" },
"next": { "key": "isha", "at": "2026-09-14T00:52:00.000Z", "local": "20:52", "tomorrow": false, "minutesLeft": 73 }
}
Responses carry Access-Control-Allow-Origin: *, so you can call the API from browser code on any domain. GET /api/prayer/methods lists the supported methods.
Frequently asked questions
How accurate are the prayer times?
The widget uses the same open-source astronomical engine (adhan) and exactly the same settings as the Niyyara app, with the calculation method and madhab you choose. Times are computed for your exact coordinates and timezone, so they agree with the app and with most established timetables to the minute. Two honest caveats: some mosques apply small manual offsets or fixed jamaat times, which the widget cannot know about, and at very high latitudes every method involves a convention (we use the same seventh-of-the-night rule as the app above 48 degrees).
Which calculation method should I choose?
Use whatever your community already follows. As a rule of thumb: ISNA in the United States and Canada, Muslim World League in Europe and most of the world, Karachi in Pakistan, India and Bangladesh, Umm al-Qura in Saudi Arabia, Egyptian in Egypt and much of the Arab world, Diyanet in Turkey, Singapore in Singapore, Malaysia and Indonesia. The configurator pre-selects a sensible method when you pick a city.
What does the madhab setting change?
Only the Asr time. The standard setting (used by the Shafi, Maliki and Hanbali schools) places Asr when an object's shadow equals its length; the Hanafi setting waits until the shadow is twice the length, which is typically 40 to 70 minutes later.
Does it work offline or without JavaScript?
No. The widget is JavaScript and fetches the day's times from niyyara.com once a day (and again after midnight). If the request fails it shows a short message instead of a broken card, and it never throws errors into your page. If you need a static, no-script timetable, call the API from your own server and print the result.
Can I remove the "Prayer times by Niyyara" line?
We ask that you keep it. That small credit link is the only thing we get back for hosting and maintaining the widget and the API for free, with no ads and no tracking, and it is how other communities discover a free tool. It is deliberately quiet: one short line at the bottom of the card, styled to match. If your organisation genuinely cannot show any third-party credit, please email hello@niyyara.com and we will talk.
Does the widget track my visitors?
No. It sets no cookies and loads no analytics. The only network request is for the prayer times themselves, and the only thing in it is the location and settings you configured. Our server logs are standard web-server logs, kept briefly for security, and are never sold or shared. The credit link carries a plain UTM tag so we can see that visits came from an embed, and nothing more.
Can I style it to match my site?
Choose the light or dark theme and, if you like, set data-width="full" so it fills a sidebar. The card is isolated in a Shadow DOM, which is what keeps it looking right on every site, so custom CSS is not supported today. If you have a strong need, write to us.
Can I show several locations or a monthly table?
You can place the script tag more than once on a page, each with its own coordinates, and each renders its own card. For a monthly or yearly table, call the API for each date from your own code.
Get the Niyyara app
Niyyara is a free, private, ad-free worship companion for iOS and Android: prayer times and azan, the full Quran with translation and recitation, Qibla, duas, the 99 Names, the Hijri calendar and gentle reminders. Learn more about Niyyara.