Qibla Direction
This qibla direction finder gives the bearing to the Kaaba in degrees from true north, with its compass point and distance, from your location, a city or coordinates. From Islamabad the qibla is about 256° (west-south-west); from Karachi it is about 268°.
Processed on your device. Nothing is uploaded.
Your location
Your location is used only on this device.
Works offline. Pakistani cities and world cities over 100,000 people.
Qibla direction
Use your location, pick a city or type coordinates to see the qibla.
Phone compasses can be off by 5 to 10°. Calibrate by moving the phone in a figure-8, hold it flat and away from metal, and check the direction against a known landmark or your local mosque. Some phones show magnetic north, which is not exactly true north; this page always gives the bearing from true north.
How to use the qibla finder
- Tap Use my location, or search for your city, or type your latitude and longitude.
- Read the bearing in degrees from true north, its compass point (for example 256° WSW) and the distance to the Kaaba.
- On a phone, tap Live compass and hold the phone flat. The dial turns with you; face the way the green arrow points.
How it works
The calculator finds the great-circle bearing (the starting direction of the shortest path over the Earth’s surface) from your position to the Kaaba at 21.422487° N, 39.826206° E:
bearing = atan2(sin Δλ · cos φ₂, cos φ₁ · sin φ₂ − sin φ₁ · cos φ₂ · cos Δλ)
Here φ₁ is your latitude, φ₂ the Kaaba’s latitude and Δλ the difference in longitude. The result is turned into degrees from 0 to 360 clockwise from true north. The distance uses the haversine formula with a mean Earth radius of 6,371 km.
The city list comes from GeoNames (CC BY 4.0): every Pakistani city in its 15,000-plus file and world cities over 100,000 people. It loads only when you start typing.
Facing the qibla
Muslims face the Masjid al-Haram in prayer: “turn your face towards the Sacred Mosque; wherever you are, turn your faces towards it” (Quran 2:144). Use the bearing with a reliable compass, a known landmark or the sun. If you pray at a mosque, its mihrab already shows the direction.
Getting a good compass reading
- Calibrate first: move the phone slowly in a figure-8 a few times.
- Hold it flat and away from metal, magnets, cars and speakers.
- Expect an error of 5 to 10° on many phones. If two phones disagree, trust a fixed mosque mihrab or a sun-based method over either.
- If your phone shows magnetic north, adjust by the local declination from NOAA. This calculator always gives the bearing from true north.
Frequently asked questions
What is the qibla direction from Pakistan?
West, slightly south. From Islamabad it is about 255.9°, from Lahore about 260.4° and from Karachi about 267.7°, measured clockwise from true north.
Why does my phone compass give a different answer?
Phone compasses can be off by 5 to 10° near metal, cars or electrical wiring, and need calibrating with a figure-8 movement. Some phones show magnetic north, which is not the same as true north. The difference (magnetic declination) changes with place and time; NOAA’s calculator gives it for your location.
Does the calculator need the internet?
No. Once the page has loaded, the bearing, distance and city search all work offline. Your location is never sent anywhere.
Why does the qibla from New York point north-east, not south-east?
Because the shortest path over a globe is a great circle. On a flat map Makkah looks south-east of New York, but the shortest route curves north over the Atlantic, so the bearing is about 58.5°.
Related tools
Sources and review
- Quran 2:144: facing the Sacred Mosque (Quran.com)
- GeoNames city data (CC BY 4.0)
- NOAA NCEI: magnetic declination
Last reviewed: .