Qibla Direction Finder
The Qibla from your city or location in degrees, with a live compass on your phone.
Your location
Search for your city or use your location. The direction is worked out on this device.
Type coordinates
North and east are positive; you can paste “33.6844, 73.0479” copied from a map, here or into the city box.
Qibla direction
- On a magnetic compass
- —
- Magnetic declination here
- —
- Distance to the Kaaba
- —
Live compass
On a phone or tablet with a compass, the card turns with the device and the arrow points at the Kaaba. North is at the top until you start it.
Face the Kaaba mark with north at the top
Without a compass: the shadow method
—
It uses the time on this device and updates every minute. You never need to look at the Sun.
About the Qibla Direction Finder
Find the Qibla, the direction of the Kaaba in Makkah, from wherever you are. Search for your city, let your browser share your location or type coordinates, and the page gives the direction in degrees from true north, the same direction on an ordinary magnetic compass, and the distance to the Kaaba.
On a phone or tablet with a compass sensor, press Start the live compass and a needle turns with the device and points at the Kaaba; the page tells you how far to turn and says when you are facing the Qibla. Without a compass, the shadow method uses where the Sun is right now: stand with your shadow in front of you and turn by the angle shown.
Everything is worked out on your device with standard spherical trigonometry and the World Magnetic Model; no map service is used and your position is not sent anywhere.
How to use it
- Type your city or town and pick it from the list, press Use my location, or open Type coordinates and paste a latitude and longitude from a map.
- Read the Qibla in degrees from true north. If you have a magnetic compass, turn until it shows the magnetic bearing the page gives.
- On a phone, press Start the live compass and allow motion access if the browser asks. Hold the phone flat, away from metal and magnets, and turn until the arrow points to the top and the page says you are facing the Qibla.
- No compass? Read the shadow method: stand so that your shadow points straight ahead, then turn by the angle shown.
- Press Copy result to keep the direction, the magnetic bearing and the distance as text.
Examples
London, England, United Kingdom
Qibla 119.0° from true north (east-southeast) · about 4,790 km (2,980 miles) to the Kaaba
New York City, United States
Qibla 58.5° from true north (east-northeast) · about 10,310 km (6,400 miles)
North-east, not south-east: the shortest path to Makkah crosses the North Atlantic. See “Why the Qibla points north-east from North America” below.
New Delhi, Delhi, India
Qibla 266.6° from true north (west) · about 3,830 km (2,380 miles)
Jakarta, Indonesia
Qibla 295.2° from true north (west-northwest) · about 7,920 km (4,920 miles)
How the direction is worked out
The Qibla is the direction of the Kaaba along the shortest path over the globe, a great circle: the bearing you set off on from where you stand. With your latitude φ and longitude λ, the Kaaba at φₖ = 21.4225° N, λₖ = 39.8262° E and Δλ = λₖ − λ, the bearing from true north is
θ = atan2(sin Δλ · cos φₖ, cos φ · sin φₖ − sin φ · cos φₖ · cos Δλ)
The distance is the great-circle distance by the haversine formula on the mean Earth radius of 6,371 km, accurate to about half a per cent. This is the method of the open-source adhan prayer-times library (MIT licence), which the Prayer Times page also uses; this tool’s tests check that both give the same bearing for places all over the world.
True north, magnetic north and your compass
Maps and the bearing above use true north, the direction of the North Pole. A magnetic compass, including the one inside a phone, points to magnetic north, which is a few degrees away in most places and much further in some. The difference is the magnetic declination, and it changes slowly from year to year.
The page takes it from the World Magnetic Model, the standard model for navigation developed by NOAA’s National Centers for Environmental Information and the British Geological Survey, for your place and today’s date. The magnetic bearing is the true bearing minus the declination (east counts as positive): in New Delhi the declination is about 1.3° E, so the Qibla of 266.6° true reads about 265.3° on a magnetic compass; in New York, about 12.5° W, the Qibla of 58.5° true reads about 71° on it. The live compass makes this correction itself.
The model’s own error for declination is shown beside it. It grows near the magnetic poles: in the far north of Canada and Greenland and on parts of the coast of Antarctica the page warns that a compass needs care, and closer still to the magnetic poles that it is unreliable, as the model’s makers do.
The shadow method: no compass needed
When the Sun is up, shadows point exactly away from it, and the page knows where the Sun is for your place and the time on your device. Stand so that your own shadow (or the shadow of an upright pole) points straight ahead of you, then turn left or right by the angle shown.
It is not usable when the Sun is below the horizon, or when it is almost straight overhead around midday (more than 75° up: in the tropics, and in summer up to about 38° north or south), because shadows are then too short to show a direction; the page says so. Never look directly at the Sun. The Sun’s position comes from the suncalc library (BSD licence), which this tool’s tests check against the astronomy-engine library.
Why the Qibla points north-east from North America
On a flat world map Makkah looks south-east of New York, but the map stretches the north. The shortest path over the globe from New York to Makkah heads north-east, over the North Atlantic: the great-circle Qibla there is about 58.5°. Following a single unchanging compass course instead (a rhumb line, the straight line on a flat map) would mean setting off at about 101°, slightly south of east, on a longer path. The same happens across Canada and the United States, and the other way round from Japan, Korea and eastern China, where the Qibla is west-northwest rather than due west.
Getting a good reading on a phone
- Calibrate the compass by moving the phone slowly in a figure of eight a few times. Safari on iPhone tells the page how accurate the compass is, and the page shows it.
- Keep away from metal and magnets: steel tables, cars, speakers, laptops, magnetic phone cases and mounts all pull a compass off.
- Hold the phone flat, or upright like a camera: the page switches to the camera direction when the phone is held up.
- Compare with the shadow method or with a magnetic compass when it matters, and use your exact position near the far side of the Earth from Makkah (in the South Pacific), where the direction changes quickly as you move.
Sources
- NOAA National Centers for Environmental Information, World Magnetic Model and its error model and blackout zones; the model’s coefficients are U.S. Government material, not subject to copyright. This tool’s tests reproduce all 100 of the model’s official test values.
- W3C, DeviceOrientation Event Specification: how browsers report a device’s orientation.
- adhan (MIT licence): the Qibla formula the tests compare against; suncalc (BSD licence): the Sun’s position.
- GeoNames place names and coordinates for the city search, licensed under CC BY 4.0.
Limitations
- A phone compass is only as good as its sensor and its surroundings: metal, magnets and electronics nearby can turn it by many degrees. Calibrate it, and check against the shadow method when you can.
- Most laptops and desktop computers have no compass a browser can read, so the live needle works on phones and tablets with one; the bearing and the shadow method work everywhere.
- The city search lists about 2,000 larger places. For a village, use your location or type its coordinates: a few kilometres make no visible difference to the direction, except very close to Makkah or on the far side of the Earth from it.
- This page does the geometry only. For questions of religious practice, such as how exact the direction must be, ask a scholar or your local mosque.
Privacy
On this device: nothing is sent
Your position stays on this device: the direction, the distance, the declination and the Sun’s position are all calculated in your browser, and nothing is sent anywhere. A city you choose, or coordinates you type, are remembered in this browser for your next visit; your device’s own location is not stored.
Frequently asked questions
How accurate is the Qibla direction shown here?
The bearing is worked out for the coordinates used with the standard spherical formula, the one the adhan prayer-times library uses, and shown to a tenth of a degree. The Earth is slightly flattened, so the shortest path over its real shape sets off a little differently: by about a tenth of a degree from London or New York, and by a few tenths at most from most places, far less than the error of a phone compass. What limits you in practice is the compass: a phone compass can be off by a few degrees even when calibrated, and much more near metal or magnets. Check it with the shadow method or a good magnetic compass when it matters.
Why is my phone’s compass different from the bearing?
Usually because the compass needs calibrating (move the phone in a figure of eight) or something magnetic is nearby. Note also that the bearing is from true north; the page gives the magnetic bearing separately for an ordinary compass, and the live needle corrects for the difference itself.
Why does the Qibla from America point north-east?
Because the shortest path over the globe from North America to Makkah crosses the North Atlantic. A flat map makes Makkah look south-east, but following that line would be a longer route. From New York the great-circle Qibla is about 58.5°; the flat-map line would be about 101°.
Can I find the Qibla without a compass?
Yes, in daylight: the page shows how to turn from your shadow to the Qibla, from where the Sun is at your place right now. It does not work at night or when the Sun is almost overhead, and you never need to look at the Sun.
Does it work on a laptop or desktop?
The direction, the magnetic bearing, the distance and the shadow method all do. The live compass needs a compass sensor, which most computers do not have, so on a computer use the bearing with a magnetic compass or the shadow method.
Is my location sent anywhere?
No. The page works out everything on your device. It remembers a city you chose, or coordinates you typed, in this browser for next time, but never stores your device’s own position.