Qibla Direction Finder
Find the exact Qibla direction from your location — a free browser-based compass with bearing calculation and optional live mobile compass.
Enter your coordinates or allow location access
How it works
Instantly find the direction of the Qibla (Kaaba in Mecca) from anywhere in the world. The tool uses spherical trigonometry to calculate the precise bearing from your coordinates to the Kaaba. It auto-detects your location via the browser Geolocation API, or you can enter coordinates manually. A static compass dial shows the Qibla direction clearly. On supported mobile devices, an optional live compass mode uses the DeviceOrientation API with magnetic declination correction for real-time directional guidance. All processing happens client-side — your location data never leaves your device.
Frequently Asked Questions
This Qibla direction finder uses the standard spherical trigonometry formula known as the great-circle bearing calculation to determine the precise compass direction from your location to the Kaaba in Mecca, Saudi Arabia (latitude 21.4225°N, longitude 39.8262°E). The formula uses the Math.atan2 function to compute the initial bearing based on the difference in longitude between your position and the Kaaba, accounting for the curvature of the Earth. This method gives the shortest-path direction along the Earth's surface, which is the approach accepted by the vast majority of Islamic scholars worldwide. The calculation is pure mathematics — it runs instantly in your browser with no server calls, API dependencies, or external data sources required.
The mathematical bearing calculation itself is extremely accurate, typically precise to within fractions of a degree. The primary source of any error is the accuracy of your input coordinates rather than the formula. When using browser-based GPS geolocation, accuracy is typically 10 to 30 meters in urban areas with clear sky visibility, which translates to a negligible bearing error for Qibla purposes. If you enter coordinates manually, the precision depends on the source of those coordinates. For practical purposes, the bearing accuracy far exceeds what you need to face the Qibla for prayer — even a few degrees of error at continental distances points you in the correct general direction. Professional surveying-grade accuracy is not necessary for the religious requirement of facing the Qibla.
No. The live compass feature relies on the DeviceOrientation API, which requires a physical magnetometer (digital compass sensor) to detect the device's heading relative to magnetic north. Desktop computers, laptops, and most monitors do not contain magnetometer hardware, so the live compass rotation is not possible on these devices. On desktop browsers, the Qibla direction finder displays a static compass dial with the Qibla direction clearly marked by an arrow and a Kaaba indicator, along with the precise numeric bearing in degrees. You can use this numeric bearing with a separate physical compass or a compass app on your phone to orient yourself. The static compass mode is fully functional and provides all the information you need to determine the Qibla direction.
Starting with iOS 13, Apple introduced a privacy restriction that requires websites to explicitly request the user's permission before accessing the device's motion and orientation sensors, including the magnetometer used for compass readings. This is a deliberate security measure by Apple to prevent websites from silently tracking device movement without user consent. When you tap the "Enable Live Compass" button, the tool triggers the DeviceOrientationEvent.requestPermission() function, which shows Apple's native permission dialog asking you to "Allow" or "Don't Allow" access to motion data. You must tap "Allow" for the live compass functionality to work. This permission request only appears once per page visit and is standard practice for any web-based compass tool on iOS devices.
Magnetic declination (also called magnetic variation) is the angular difference between magnetic north — the direction that a compass needle points — and true north, which is the geographic North Pole. This offset exists because the Earth's magnetic poles do not align perfectly with its geographic poles, and the offset varies significantly depending on your location on the planet. In some regions, the declination can be as much as 20 degrees or more, which would introduce a significant error in Qibla direction if not corrected. This tool automatically compensates for magnetic declination using the World Magnetic Model (WMM 2025-2030), which is an internationally recognized mathematical model computed entirely on your device using the lightweight magvar library. This ensures that the Qibla bearing shown is relative to true geographic north, not magnetic north.
No. This Qibla direction finder is designed to operate entirely client-side with zero external dependencies. The bearing calculation to the Kaaba is pure trigonometric math that runs in your browser's JavaScript engine. The magnetic declination correction uses an embedded implementation of the World Magnetic Model (WMM 2025-2030) via the magvar library, which computes the correction locally without contacting any server. The geolocation feature uses your browser's built-in Geolocation API, which communicates directly with your device's GPS hardware and operating system — the coordinates are passed to the JavaScript calculation, not to any external service. Your location data never leaves your device, making this one of the most private Qibla finders available online.
Yes. While the Qibla direction finder can auto-detect your location using the browser's Geolocation API for convenience, it also provides manual coordinate input fields where you can type your latitude and longitude directly. This is useful if you have disabled location services on your device, if your browser does not support geolocation, or if you want to find the Qibla direction for a location other than where you currently are — such as a future travel destination, a new home you are moving to, or a mosque you are helping to orient. You can easily find your coordinates by looking them up on Google Maps (right-click any point to see its coordinates) and entering them into the Qibla finder manually.
Yes. This Qibla direction finder is completely free to use with no restrictions, no advertisements, no account registration, and no premium features hidden behind a paywall. You get the full bearing calculation, the static compass visualization, and the live mobile compass feature all at no cost. The tool runs entirely in your web browser using standard JavaScript and the lightweight magvar library, so there are no ongoing server costs to maintain. It will remain free permanently. You can use it as often as you need, from any location in the world, on any device with a modern web browser.
If you are using the Qibla finder on a desktop computer or prefer to use a physical compass, the tool displays the Qibla bearing as a precise number in degrees from true north (for example, "243.7 degrees from North"). To use this with a physical compass, first ensure your compass is calibrated and hold it level. Identify the north direction on your compass, then rotate yourself until you are facing the degree reading shown by the Qibla finder. For most locations in South Asia, the Qibla is roughly west, while for locations in North America it is roughly northeast, and for Europe it is roughly southeast. The displayed bearing accounts for the great-circle (shortest) path to Mecca, which may feel counterintuitive on a flat map but is the correct direction on the curved surface of the Earth.
There are several reasons why the Qibla direction calculated by this tool might differ slightly from the direction your local mosque faces. First, some older mosques were built before precise GPS and computational tools were available, and their orientation may be based on earlier, less accurate methods. Second, some scholars follow the "facing the general direction" opinion rather than the "precise bearing" opinion, which can result in a broader acceptable range. Third, the great-circle bearing (used by this tool and accepted by the majority of scholars) can differ from the rhumb line bearing that some communities prefer, especially at very long distances. In practice, a difference of a few degrees is generally considered acceptable by all schools of Islamic jurisprudence, as the requirement is to face the general direction of the Kaaba rather than pinpoint it with surveying precision.
Related Tools
Hijri to Gregorian Converter
Convert dates between the Islamic Hijri (Umm al-Qura) and Gregorian calendars instantly — free, bidirectional, and 100% in your browser.
Digital Tasbeeh Counter
A free, distraction-free digital tasbeeh (dhikr) counter that saves your progress — tap to count, set targets, and track your remembrance in the browser.
Ramadan Fasting Tracker
Track your Ramadan fasts with accurate Sehri and Iftar times, a live countdown, and a 30-day calendar — all calculated locally in your browser.
Easter & Holiday Calculator
Calculate the date of Easter and all related moveable feasts for any year using the Computus algorithm — free, instant, and in-browser.
Bible Reading Plan Generator
Generate a personalized Bible reading plan — choose linear, chronological, or blended modes for any duration. Free, no sign-up, runs in your browser.
Liturgical Season Tracker
See the current liturgical season, its color, and a full year-at-a-glance church calendar — free, instant, and runs in your browser.
Tithe & Offering Calculator
Calculate your tithe and offerings from gross or net income at any frequency — a simple, private, free calculator in your browser.
Global Festival Countdown
Countdown to major world festivals — Eid, Diwali, Hanukkah, Christmas, Chinese New Year, Easter, and more. Free and in-browser.
