Qibla Direction Calculator
Find the Qibla — the direction to the Kaaba in Mecca — from any latitude and longitude as a compass bearing (great-circle initial bearing), with the magnetic declination adjustment for a compass, the distance to Mecca, the constant-bearing (rhumb) alternative and the sun-shadow method on Qibla days.
How it works
Initial great-circle bearing θ = atan2( sin Δλ · cos φ₂ , cos φ₁ · sin φ₂ − sin φ₁ · cos φ₂ · cos Δλ ) with the Kaaba at 21.4225° N, 39.8262° E; magnetic bearing = true bearing − declination (east +); distance = R · arccos(sin φ₁ sin φ₂ + cos φ₁ cos φ₂ cos Δλ)
The Qibla is the direction of the Kaaba, and on a round Earth “direction” means the initial bearing of the shortest path, the great circle. That produces results that surprise map readers: from New York the Qibla is north-east, not east-south-east, because the shortest route arcs over the North Atlantic — the same reason airliners fly polar routes. A compass needle points to magnetic north, which differs from true north by the local declination (a dozen degrees or more in places), so the true bearing must be corrected for a physical compass, though phone apps handle this. Twice a year the sun passes directly over Mecca, and at that moment every shadow on the sunlit half of the planet points away from the Qibla — a centuries-old check that needs no instruments.
Worked example
From New York (40.71° N, 74.01° W) the great-circle bearing to the Kaaba is 58.5° — north-east — at a distance of about 10,300 km; with −12.5° of magnetic declination a compass should read about 71°. The constant-bearing rhumb line would point 101°, about 43° away, which is why using a flat map misleads.
Frequently asked questions
Which method is “correct”?
The great-circle direction is the consensus of Islamic jurists and astronomers and is used by mosques worldwide; a minority historically used rhumb lines, but the difference matters only far from Mecca.
How precise does it need to be?
Facing the general direction (jihat al-Kaaba) is accepted by most schools when far away; aim within a few degrees and do not worry about arc-minutes.
Related calculators
Calendar and astronomical results are computed (tabular Hijri, NOAA solar equations); local moon-sighting, your mosque’s convention and a qualified scholar govern religious practice.