How does a qibla compass work, and why does it drift?

A brass plumb bob hanging from a fine thread above cream paper, its long shadow cast by a single low beam of sunlight

A phone’s qibla compass does two jobs. It calculates the angle from where you stand to the Kaaba. Then its magnetic sensor finds north and the angle is laid on the screen. The calculation is usually right. The drift comes from the second step — magnetic north is not true north, and nearby metal or magnets mislead the sensor.

Here we explain how the angle is found, why the needle jumps, and how to check it without a phone. We add what we learnt while building the qibla screen in Mümin 360. We give no religious ruling here. For official guidance we point to the prayer time calculation pages of Diyanet, Türkiye’s Presidency of Religious Affairs.

How is the qibla angle calculated?

The qibla angle is the angle between north and the shortest path from your location to the Kaaba. Diyanet’s qibla angle page defines it as the solution of a spherical triangle formed by the Kaaba, your location and the North Pole. It is read in degrees, clockwise from north.

Because the Earth is round, that shortest path is an arc of a “great circle”. A straight line drawn on a flat map does not point the same way. The gap grows the further you are from the Kaaba.

Taking the Kaaba as 21.4225° N, 39.8262° E, we calculated the angle for a few cities ourselves:

CityQibla angle (from true north)Straight line on a flat mapDistance to the Kaaba
İstanbul (Fatih)151.6°154.8°≈ 2,405 km
İzmir (Konak)143.7°147.2°≈ 2,246 km
Berlin136.7°146.6°≈ 4,130 km
London119.0°133.8°≈ 4,794 km
New York58.5°101.3°≈ 10,306 km

The flat-map column is the constant-bearing line you would draw with a ruler on a flat map. In İstanbul the two differ by about 3 degrees. From New York the qibla is north-east, not south-east as a flat map suggests. The gap exceeds 40 degrees.

Does our calculation match Diyanet’s figure?

It does — but Diyanet gives two angles, and it matters which one you read. From the district files linked on Diyanet’s qibla angle page, we downloaded the one for Konak in İzmir. It lists:

  • Qibla angle: 140°
  • Project qibla angle: 144°
  • Compass deviation: 3.98° east

Our calculation for the same coordinate came to 143.7°, which matches the project angle. The 4-degree gap between 140° and 144° equals the compass deviation in the same file. So 140° is the figure to read on a magnetic compass. The file dates from 2013, and declination shifts over the years, so today’s compass figure may differ slightly.

What is the difference between true north and magnetic north?

A compass does not find the geographic North Pole. It follows the direction of the Earth’s magnetic field. According to the declination page of NOAA, the US scientific agency, magnetic declination is the angle between magnetic north and true north. The same page notes that declination changes over time and with location.

The qibla angle is calculated from true north, whilst the compass finds magnetic north. If an app lays one over the other without correcting, the arrow is off by the declination. In the Konak example that is about 4 degrees.

You can look up today’s declination for your location with NOAA’s declination calculator. A good qibla app makes this correction itself from your location. With a plain hand compass, you make the correction yourself.

Why does the compass on my phone jump or drift?

The phone’s magnetic sensor is very sensitive and reads every magnetic field nearby. Apple’s guide to the iPhone compass warns that its accuracy can be affected by magnetic or environmental interference. The same guide advises holding the phone flat for accurate bearings.

The most common causes:

CauseWhat happensWhat to do
Magnetic case or card walletThe arrow is pulled the same way every timeTake the phone out of the case
Inside a carThe body and engine throw it well offGet out and walk a few steps away
Reinforced concrete, metal tablesThe reading changes from spot to spot indoorsMeasure by a window or outdoors
Speakers, laptopsThe arrow wanders as you get closerMove a metre or so away from devices
Phone held at a tiltThe angle varies from one look to the nextHold the phone flat

The steel bars inside reinforced concrete also disturb the field. So two rooms in the same house giving different readings is no surprise. If you want to set the qibla for a building, measuring outdoors and carrying the line inside is safer.

How can I check the qibla on my phone?

To make the reading on your phone dependable, work through these steps:

  1. Move the phone away from a magnetic case and any metal surface.
  2. Allow location access. The angle is worked out from your location; a city picked by hand uses the city centre.
  3. Hold the phone flat.
  4. If the app asks you to calibrate, follow the instructions on screen.
  5. Move a few steps and look again. If the arrow holds steady, the reading is consistent.
  6. Compare the result once with one of the sun methods below.

How do you find the qibla without a phone?

The most reliable method needs no phone at all: the sun. The moment when the sun stands in the qibla direction can be calculated. Diyanet calls it “qibla time” (kıble saati).

According to Diyanet’s qibla time page, it is the moment the sun lines up with the qibla direction. It depends on the sun’s position, so it changes every day. For Turkish cities it appears in the last column of the prayer calendar.

At that moment, turning to face the sun means facing the qibla. The shadow of an upright object falls along the same line, with its tip pointing away from the qibla. Diyanet also notes that a qibla time applies only to the city named.

On two days a year this becomes easier still. According to Diyanet’s World Qibla Day page, on these days the sun stands directly above Makkah:

DayTürkiye time (UTC+3)UTC
28 May12:1809:18
16 July12:2709:27

The UTC column is our own conversion. Wherever the sun is above the horizon at that minute, facing it means facing the qibla. In London that is 10:18 and 10:27 British Summer Time.

How does Mümin 360 show the qibla?

The qibla screen in Mümin 360 shows a compass and the bearing in degrees. As our privacy policy sets out, the qibla direction is calculated on the phone. The motion and heading sensors run only while the qibla screen is open.

Location access is requested only “While Using the App”, never in the background. If you decline, you pick your city from a list. Your coordinates are not sent anywhere to calculate the qibla.

There are no ads on the qibla screen, and the qibla is free for everyone. Our terms of use say plainly that the compass depends on the phone’s heading sensor. Magnets, metal and electronic devices can throw it off. That is why we recommend the sun check above as well.

We gathered the other things to look for in how to choose a prayer times app. Why times differ between apps is in why prayer times differ between apps, and the methods used abroad are in prayer times abroad.

Frequently asked questions

Is the qibla on my phone accurate?

The calculated angle is right if your location is right. Errors nearly always sit on the compass side: declination left uncorrected, or metal nearby. Holding the phone flat and away from metal, then checking once against the sun, is the soundest approach.

Why is the qibla from Europe not simply south-east?

Because the angle follows a great circle, not a straight line on a flat map. By our calculation the qibla from London is 119.0° from true north, against 133.8° along a flat-map line. From New York it is north-east, at 58.5°.

Why is Diyanet’s listed angle a few degrees off my app?

Diyanet’s district files give two angles. One is read on a compass; the project angle is measured from true north. The difference is the compass deviation. If your app works from true north, compare it with the project angle.

Is qibla time the same everywhere?

No. According to Diyanet, qibla time changes daily and applies only to the city named. The exceptions are 28 May and 16 July. The sun then stands directly above Makkah, so facing it works wherever it is up.

Mümin 360 - Namaz Kıble Zikir is free on the App Store: see Mümin 360 on the App Store. If you are planning an app that relies on a phone’s sensors, our custom software and mobile apps page explains how we work.

— Work in this article

The project this article refers to.