Facing the Kaaba
In prayer, Muslims face the Qibla: the direction of the Kaaba in Makkah. Near Makkah you can face it directly. Further away, the Kaaba is over the horizon, so you need to know which way it lies. For centuries, Muslim astronomers developed sophisticated methods to find the Qibla from anywhere, a major achievement of medieval mathematical astronomy. Today the same geometry runs on a phone in a fraction of a second.
The shortest path on a sphere
On a flat map it’s tempting to draw a straight line to Makkah and measure its angle. But the Earth is round, and flat maps distort direction. The accepted approach is the great circle: the shortest path over the Earth’s surface between two points, like the route an aircraft flies. The Qibla is the direction in which that shortest path starts from where you’re standing, measured as a bearing clockwise from true north (0° north, 90° east, 180° south, 270° west).
Text version of this diagram
The Qibla direction is the starting bearing of the shortest path over the Earth’s surface (a great circle) from your location to the Kaaba in Makkah. It is measured clockwise from true north and worked out with spherical trigonometry from two pairs of latitude and longitude. From most of India it points roughly west.
The formula in plain words
With your latitude φ, the Kaaba’s latitude φₖ, and the difference in longitude Δλ (Kaaba’s longitude minus yours), the bearing q is:
q = atan2( sin Δλ, cos φ · tan φₖ − sin φ · cos Δλ )
The Kaaba is at about 21.4225° N, 39.8262° E. The function atan2 returns an angle in the correct quadrant; the result is then expressed between 0° and 360°.
You don’t need to compute it yourself, but it shows that the Qibla depends only on where you are. It doesn’t change with the date or the time of day.
Qibla bearings for some Indian cities
Calculated with the great-circle formula above. Bearings are clockwise from true north; 270° is due west.
| City | Qibla bearing | Direction | Distance to Makkah (approx.) |
|---|---|---|---|
| Srinagar | 256.8° | West, 13° towards south | 3,700 km |
| Delhi | 266.6° | West, 3° towards south | 3,840 km |
| Ahmedabad | 273.4° | West, 3° towards north | 3,370 km |
| Guwahati | 275.8° | West, 6° towards north | 5,280 km |
| Kolkata | 278.2° | West, 8° towards north | 4,980 km |
| Mumbai | 280.1° | West, 10° towards north | 3,450 km |
| Hyderabad | 282.7° | West, 13° towards north | 4,070 km |
| Chennai | 287.9° | West, 18° towards north | 4,380 km |
| Kochi | 292.6° | West, 23° towards north | 4,090 km |
Notice the pattern: from northern India the Qibla is slightly south of west, and from southern India it is increasingly north of west. That’s because Makkah, at about 21° N, lies north of southern India and south of northern India, and the great circle curves accordingly.
From true north to your compass
A phone compass senses the Earth’s magnetic field, and magnetic north differs from true north by the magnetic declination. Across India, declination is small, roughly within a degree or two, and phones typically correct for it using your location. The larger sources of error are local:
- Metal and magnets: steel furniture, reinforced concrete, cars, railings, speakers, magnetic phone cases and mounts.
- Calibration: phone compasses drift; calibrate by moving the phone in a figure-of-eight when prompted.
- Tilt: hold the phone flat.
For daily prayer, scholars generally hold that facing the general direction of the Qibla with reasonable effort is sufficient when the Kaaba isn’t in sight. For a mosque or permanent prayer space, communities often use more careful surveying or established local directions.
Without a compass
Two traditional methods still work:
- The Sun. Knowing the time of solar noon, when the Sun is due south in India, you can find south, and from it your Qibla bearing.
- Qibla-direction days. On two days a year, around 28 May and 16 July, the Sun is directly over the Kaaba at Makkah’s solar noon (about 12:18 Makkah time, or 14:48 IST, in May, and about 12:27 Makkah time, or 14:57 IST, in July). At that moment, shadows of vertical objects everywhere the Sun is visible point directly away from the Qibla.
In OIOA
OIOA calculates the Qibla direction on your phone from your location using the great-circle method, so it works offline, wherever you travel. Calibrate your compass and keep away from metal for the most accurate reading.
Common questions
Why is the Qibla from Delhi south of west, but from Mumbai north of west?
Because of where Makkah lies. At about 21.4° N, it’s south of Delhi (28.6° N) and north of Mumbai (19.1° N) and Chennai (13.1° N). The great circle from each city starts out in a direction that reflects this, curving with the Earth’s surface.
Does the Qibla change during the day?
No. It depends only on your location and the Kaaba’s. It doesn’t change with the time of day or the date.
My phone shows a different Qibla in two apps. Why?
If both use the great-circle method, the calculated bearing should be the same. The difference is almost always the compass reading: calibration, nearby metal or a magnetic case. Try calibrating and moving to a different spot.
Is facing exactly the right degree required?
Scholars generally hold that facing the direction of the Qibla with reasonable effort fulfils the requirement when the Kaaba isn’t in sight. For a mosque’s mihrab, communities take more care. Please follow your scholars.
Key terms
- Qibla: the direction of the Kaaba in Makkah.
- Great circle: the shortest path between two points on a sphere.
- Bearing: a direction measured clockwise from true north, from 0° to 360°.
- True north: the direction to the geographic North Pole.
- Magnetic declination: the angle between true north and magnetic north at a place.
- Mihrab: the niche in a mosque’s wall that indicates the Qibla.
Related: how prayer times are calculated and why sunrise times differ across India.