Qibla Finder
Find the Qibla direction from IP, city search, Browser GPS, or manual coordinates with true or magnetic bearing and turn guidance.Current bearing
| Field | Value | Copy |
|---|---|---|
| {{ row.label }} | {{ row.value }} |
| Step | Guidance | Copy |
|---|---|---|
| {{ row.step }} | {{ row.guidance }} |
Finding the Qibla is a direction problem, not just a question of which city is east or west. The reference point is the Kaaba in Makkah, while the direction is read from the exact place where a person is standing. A small change in location usually changes the bearing only slightly, but a wrong city, a VPN-based IP location, or a bad compass reference can move the practical direction enough to matter.
A bearing is a clockwise angle from north. North is 0°, east is 90°, south is 180°, and west is 270°. Qibla bearings normally use the initial direction along a great-circle route, which is the shortest surface path on a spherical Earth model. That is why the correct first heading can look surprising when compared with a flat wall map or a rectangular world map.
- Coordinates decide the starting point. Latitude sets north-south position, and longitude sets east-west position.
- The north reference decides what instrument matches the number. True north fits maps, while magnetic north fits a physical compass only after local declination is accounted for.
- The current facing direction decides the turn instruction. The Qibla bearing itself does not change when a person turns around.
- Distance is useful context. It is not a travel distance and should not be used to choose a walking route.
Most mistakes come from treating the bearing as more certain than the source data. A public-IP estimate may identify a network provider's city rather than the building where someone is praying. A place search may use a city center or a similarly named neighborhood. Browser GPS can be much better outdoors, but permission, device hardware, and nearby buildings still affect the reported coordinates.
True and magnetic bearings also need to stay separate. A map heading is normally measured from true north, while a handheld compass needle points toward magnetic north. Magnetic declination is the local angle between those two references, and its sign matters. Entering east declination as west, or using an old value after moving to another region, can shift the compass direction even when the latitude and longitude are correct.
How to Use This Tool:
Start by choosing the location source that matches the situation, then decide whether the final heading needs to match a map or a physical compass.
- Leave
Location sourceonIP Geolocationfor a rough first reading. The lookup runs on load and fillsLatitude,Longitude,Location source, andSource notefrom public-IP location data. - Choose
City Searchwhen the IP estimate is not close enough. Type a city, landmark, district, or address, pressSearch, then select a listed match if the first result is not the right place. - Choose
Browser GPSwhen you can grant location permission and want device-based coordinates. If the browser denies or cannot provide a position, switch to city search or manual coordinates. - Use
Manual Coordinateswhen you already have trusted decimal coordinates. Latitude must stay from-90to90, longitude from-180to180; blank or invalid coordinates show the warning to enter valid coordinates. - Set
North referencetoTrue northfor map work. Set it toMagnetic northonly when following a compass, then enterMagnetic declinationfrom-30to+30degrees with east positive and west negative. - Set
Current facingif you want the summary andCompass Stepstable to say how far to turn left or right from the direction you face now. - Open
Advancedonly when you need a differentEarth radius modelfor distance context or differentDecimal precisionfor displayed values. - Use
Active reference heading,Cardinal direction, andTurn guidanceas the main direction outputs. OpenQibla Lineto check the two map points andJSONwhen you need the same values in structured form.
Interpreting Results:
Active reference heading is the number to follow. It is labeled as true or magnetic so you can match it to the instrument in use. The compass rose gives the same bearing visually, while Cardinal direction turns the degree value into a broad direction such as ENE or WNW.
Turn guidance depends on Current facing. If the facing value is stale, the left-or-right instruction is stale too. The aligned status appears when the selected bearing and facing direction are within one degree, which is a practical tolerance for ordinary setup rather than a promise of survey-grade alignment.
Great-circle distance and Central-angle arc explain the geometry between your coordinates and the Kaaba. They are not road, flight, or walking distances. Changing the Earth radius model changes the distance number, but the Qibla bearing is still computed from the same two coordinate pairs.
The main false-confidence risk is a precise-looking heading from a weak location source. If the Qibla Line marker is not where you are, or if the compass heading feels far off, verify the displayed coordinates, the north reference, the declination sign, and the current facing value before relying on the turn instruction.
Technical Details:
The Qibla heading is modeled as an initial bearing from an observer coordinate pair to fixed Kaaba coordinates. The fixed Kaaba coordinate pair used here is 21.422487 latitude and 39.826206 longitude. The angle is measured clockwise from local north at the observer's point, then wrapped into the range from 0° up to but not including 360°.
Great-circle geometry matters because the Earth is curved. On a sphere, the shortest surface route between two points lies on a great circle. The initial bearing is the direction of that route as it leaves the starting point, so it can differ from what a straight segment appears to show on a flat map projection.
Formula Core
The bearing formula uses the observer latitude lat, observer longitude lon, Kaaba latitude latK, and Kaaba longitude lonK. Angles are converted to radians before the trigonometric steps, then converted back to degrees for display.
Magnetic mode applies the entered declination after the true bearing is known. With the east-positive convention, the compass heading is the true bearing minus declination, then wrapped back into the same 0° to 360° range.
Distance uses the haversine central angle and the selected Earth radius. That radius choice affects Great-circle distance only; it does not feed back into the bearing formula.
For Kuala Lumpur at 3.1390 latitude and 101.6869 longitude, the true bearing is about 292.54°. With current facing set to 0°, the turn guidance is about 67.5° left. The mean-radius distance is about 6,973.9 km, while switching to the equatorial or polar radius changes only that kilometer figure.
| Quantity | Range or source | Technical effect |
|---|---|---|
Latitude |
-90° to 90° decimal degrees. | Changes bearing, central angle, distance, map marker, and turn guidance. |
Longitude |
-180° to 180° decimal degrees. | Changes bearing, central angle, distance, map marker, and turn guidance. |
Magnetic declination |
-30° to +30°, east positive and west negative. | Changes the magnetic heading only. Positive declination subtracts from the true bearing. |
Current facing |
0° through 359.9°, clockwise from north. | Changes the left-or-right turn instruction, not the Qibla bearing. |
Earth radius model |
Mean 6371.0 km, equatorial 6378.137 km, or polar 6356.752 km. | Changes Great-circle distance; bearing stays unchanged. |
Decimal precision |
1 to 4 displayed decimal places. | Changes visible rounding in results and exports; calculations keep more precision before display. |
Coordinate boundaries are clamped to valid latitude and longitude ranges. Blank or nonnumeric coordinates are treated as invalid and stop the result until a valid pair is present. The cardinal label is chosen from 16 compass sectors, so it is a readable orientation cue rather than a replacement for the degree bearing.
Accuracy and Privacy Notes:
The calculation can be exact for the displayed inputs, but the real-world direction is only as good as the location, declination, and compass setup behind those inputs.
IP Geolocationdetects the public IP address and uses remote IP-location data, so it can expose the public IP to external lookup services and may return city-level or network-provider coordinates.City Searchsends the submitted place text to OpenStreetMap Nominatim and uses mapped result coordinates. Ambiguous names should include country or region.Browser GPSasks through the browser permission prompt and returns the device position when available. Accuracy can vary with hardware, sky view, operating-system settings, and nearby structures.Manual Coordinatesavoid automatic lookup, but the current URL may still carry coordinates and settings for state sharing. Do not share that URL when location privacy matters.- After coordinates are available, bearing, distance, table, compass-step, and JSON results are calculated from the displayed values in the browser session.
Worked Examples:
Kuala Lumpur with true north
Using the city preset for Kuala Lumpur gives latitude 3.1390 and longitude 101.6869. With North reference set to true north and Current facing at 0°, Active reference heading is about 292.54° true, Cardinal direction is WNW, and Turn guidance says to turn about 67.5° left.
New York while facing west
Manual coordinates for New York City, 40.7128 latitude and -74.0060 longitude, produce a true bearing near 58.48°. If Current facing is 270° because you are facing west, Turn guidance says to turn about 148.5° right. The degree heading is the practical value; the Qibla Line map is mainly a location check.
Magnetic compass sign check
If a location has a true bearing of 292.5° and local declination is +1.5° east, magnetic mode reports about 291.0°. If entering -1.5° makes the compass agree better, the original declination sign was probably reversed for the source you copied.
IP location looks close but not right
An IP result may put the map marker in the right metro area but not at the building where you are. When Source note says approximate public-IP location and the marker is visibly wrong, switch to Browser GPS, choose a better City Search match, or enter trusted manual coordinates before using Compass Steps.
FAQ:
Should I use true north or magnetic north?
Use true north for map alignment and most digital map references. Use magnetic north only when following a physical compass, and enter local magnetic declination with east as positive and west as negative.
Why is the Qibla not simply east or west?
The bearing comes from your coordinates to the Kaaba over a great-circle route. Depending on where you are, the initial heading may be northeast, southeast, west-northwest, or another compass sector.
What should I do if GPS permission is denied?
Use City Search for a mapped place or enter Latitude and Longitude manually. The result appears again once both coordinates are valid.
Why did my IP location give a poor result?
Public-IP location can point to an ISP, VPN, proxy, or regional network hub. Check the Location source, Source note, and Qibla Line marker before trusting the heading.
Does decimal precision make the direction more accurate?
No. Decimal precision changes displayed rounding only. Better coordinates, the correct north reference, and the correct declination value improve the real setup more than extra digits.
Why does changing Earth radius not change the bearing?
The radius model is used for Great-circle distance. The initial bearing uses the two coordinate pairs, so the selected radius does not change Active reference heading.
Glossary:
- Qibla
- The direction Muslims face toward the Kaaba in Makkah for prayer.
- Bearing
- A clockwise angle from north to a target direction, measured in degrees.
- Great-circle route
- The shortest path between two points on a spherical surface.
- True north
- North referenced to the Earth's geographic pole.
- Magnetic north
- The direction a magnetic compass needle points at a given place and time.
- Magnetic declination
- The angle between magnetic north and true north, entered here as east positive and west negative.
- Central-angle arc
- The angle at the Earth's center between the observer's coordinates and the Kaaba coordinates.
References:
- How Qibla Finder works, Google Help.
- Magnetic Declination, NOAA National Centers for Environmental Information.
- Geolocation API, MDN Web Docs, March 10, 2026.
- Search, Nominatim Documentation.
- Nominatim Usage Policy, OpenStreetMap Foundation Operations Working Group.
- Can you help track a mobile device or someone's exact geolocation?, IPinfo, November 4, 2025.