Qibla direction finder
The Qibla bearing from any place, from your phone's location or typed coordinates, with the formula and a compass arrow.
The defaults are Hyderabad. Press "Use my location" on a phone to fill in where you are.
How the bearing is calculated
The Qibla is the direction of the shortest path over the Earth's surface to the Kaaba in Makkah, whose position is taken as 21.4225° N, 39.8262° E. From a point at latitude φ1 and longitude λ1, with the Kaaba at φ2, λ2 and Δλ = λ2 − λ1, the initial bearing from true north is
θ = atan2( sin Δλ × cos φ2 , cos φ1 × sin φ2 − sin φ1 × cos φ2 × cos Δλ )
measured clockwise from north, with 0° north, 90° east, 180° south and 270° west. This is the standard great-circle bearing; it is what the astronomical tables used by mosques are built on.
Worked example
Hyderabad (17.385° N, 78.4867° E). Δλ is 39.8262 − 78.4867 = −38.66°. Working through the formula gives θ = 282.7°, which is west with a lean to the north: a little more than a quarter turn past west towards north-west. Pune comes out at 281.0° and Delhi at 266.6°, so across most of India the Qibla is west and slightly north, and the further north you are, the more directly west it points.
Using it with a phone compass
- Open your phone's compass app, hold the phone flat away from metal and speakers, and turn until the compass reads the bearing above. Phone compasses drift; calibrate (the figure-of-eight wave) if the reading jumps.
- The number is from true north. A magnetic compass points to magnetic north, which differs from true north by the local magnetic declination. Across India the difference is small but not zero; if you need it exact, look up the declination for your city and add it.
- In a mosque, follow the mihrab. This page is for a hotel room, a train, a new flat or checking a prayer mat's arrow, not for correcting a mosque.
- If you are within a few hundred metres of a known masjid, its wall is a better reference than any phone.
Where your location goes
Nowhere. "Use my location" asks your browser for the phone's coordinates and fills the two boxes on this page. The calculation runs on your device; we keep no log of it.