How to use the Qibla Direction Finder
- 1Choose your city or use your current location.
- 2Read the Qibla bearing in degrees from true north.
- 3On a phone, press “Use phone compass” and turn until the arrow points straight up.
- 4On a computer, use the diagram with a separate compass.
What is the Qibla direction?
The Qibla is the direction Muslims face during prayer: towards the Kaaba in Makkah, Saudi Arabia (21.4225° N, 39.8262° E). This Qibla finder calculates the exact direction from your city as a compass bearing in degrees from true north. On a phone with a compass sensor, it can also turn into a live pointer that shows the way as you rotate.
From Karachi the Qibla is about 268°, a little north of due west. From Lahore and Islamabad it is about 256° to 260°, slightly south of due west.
How is the Qibla direction calculated?
The tool uses the great-circle method: the shortest path between two points on a sphere. This is the method used by Islamic authorities and navigators, because the Earth is round and a straight line on a flat map is not the shortest route.
The initial bearing θ from your location (latitude φ₁, longitude λ₁) to the Kaaba (φ₂, λ₂) is:
θ = atan2( sin Δλ, cos φ₁ · tan φ₂ − sin φ₁ · cos Δλ )
where Δλ = λ₂ − λ₁. The result is converted to degrees and normalised to 0–360°, measured clockwise from true north. The distance uses the haversine formula with an Earth radius of 6,371 km. Both formulas are standard spherical trigonometry, explained clearly on Movable Type Scripts.
Worked example: Qibla from Pakistani cities
| City | Qibla bearing | Rough direction | Distance to Kaaba |
|---|---|---|---|
| Karachi | 267.7° | West | 2,800 km |
| Quetta | 256.7° | West-southwest | 2,878 km |
| Lahore | 260.4° | West | 3,598 km |
| Islamabad | 255.9° | West-southwest | 3,528 km |
| Peshawar | 254.0° | West-southwest | 3,401 km |
| London (for comparison) | 119.0° | Southeast | 4,794 km |
So, in Karachi, stand facing north, then turn left (anticlockwise) by about 92°. That leaves you facing almost exactly west, very slightly south.
How do I use the phone compass mode?
- Open this page on your phone and press Use phone compass. On iPhone, Safari will ask to allow motion and orientation access.
- Hold the phone flat, screen up, at waist height.
- Turn your body until the green arrow points straight up the screen. The page shows "Facing the Qibla" when you are within 5°.
Calibrating the compass
Phone compasses are magnetometers. They are easily confused by:
- steel furniture, car bodies and reinforced concrete,
- speakers, magnetic phone cases and laptop chargers,
- electrical wiring in walls.
If the reading jumps or seems wrong, step away from metal and move the phone slowly in a figure-8 a few times. Then check again. If you have no compass sensor (most laptops), use the diagram with a separate compass, or line yourself up using a known landmark.
Tips
- Use Use my location for the most accurate result outside listed cities.
- Mark the direction once with tape or a sticker on the floor at home so you do not need the phone every time.
- Need prayer times too? Open Prayer Times. For Ramadan timings see the Ramadan Calendar.
- Curious what sensors your phone and browser support? The What Is My Browser tool shows your device details.
Limitations
- Phone compass readings can be off by 5° to 20° near metal. The calculated bearing is exact; the sensor is the weak point.
- Some browsers (especially on desktop) do not provide compass data at all.
- The bearing is from true north. A basic handheld compass points to magnetic north. In Pakistan the difference (magnetic declination) is small, about 1° to 3°, so for prayer it rarely matters.
Frequently asked questions
What is the Qibla direction from Karachi?
About 267 degrees from true north, which is just south of due west. Lahore and Islamabad are slightly further round, at roughly 255 to 260 degrees.
Why is the Qibla not exactly west from Pakistan?
The Qibla follows the shortest path over the curved Earth (a great circle), not a line on a flat map. From Pakistan that path points slightly south of west.
Why does the phone compass jump around?
Phone compasses are magnetic sensors and are disturbed by metal, magnets, speakers and electrical wiring. Move away from them and wave the phone in a figure-8 to recalibrate.
Is the compass bearing true north or magnetic north?
The calculated bearing is from true north. Phone compass readings are usually corrected to true north by the operating system, but a basic handheld compass shows magnetic north, which in Pakistan differs by only a couple of degrees.
Last updated: . Written and tested by Abdul Moid Khan, ATechCraft. Read how we build and test tools.