← All posts

How to find the Qibla from anywhere

Why the Qibla from New York points north-east, not south-east, how Quba works out the direction, and how to get an accurate reading on your phone.

The Qibla is the direction of the Kaaba in Makkah, which Muslims face in prayer. Quba shows it with a compass on your phone, worked out from your location. Here is how that direction is found, why it sometimes surprises people, and how to get a reading you can trust.

The shortest path, not the line on a flat map

The Earth is round, so the most direct way to the Kaaba is a great circle: the shortest path over the surface of the globe, the route a long-haul flight takes. The Qibla is the direction in which that path leaves your town.

On a flat world map the Kaaba often seems to lie in a different direction. From New York it looks south-east, but the shortest path heads north-east, curving up over the Atlantic. The further you are from Makkah, the bigger the difference.

From Qibla (from true north) Distance to the Kaaba
London 119° (east-south-east) 4,794 km
Stockholm 148° (south-south-east) 4,554 km
Istanbul 152° (south-south-east) 2,405 km
Cairo 136° (south-east) 1,287 km
Karachi 268° (west) 2,800 km
Jakarta 295° (west-north-west) 7,920 km
Sydney 278° (west) 13,236 km
New York 59° (east-north-east) 10,306 km
Toronto 55° (north-east) 10,496 km
Los Angeles 24° (north-north-east) 13,424 km

Quba uses the great-circle direction, as most Qibla apps and calculators do. Some older mosques, particularly in North America, were built facing the direction on a flat map. If your mosque faces differently from the app, follow the guidance of your local scholars.

How Quba works it out

The app needs only two things: where you are and where the Kaaba is.

  • Your location comes from your phone's GPS, or from a city you pick from the built-in list. Either way, it stays on your phone. The calculation runs on the device and works offline.
  • The Kaaba is at 21.4225° N, 39.8252° E.

From these, Quba calculates the great-circle bearing using the open-source Adhan library, the same one it uses for prayer times. The result is an angle measured clockwise from true north, along with the distance to the Kaaba.

The compass then compares that angle with the direction your phone is pointing. It tells you to turn left or right by a number of degrees, and when you are within a few degrees of the Qibla it says you are facing it and gives a short vibration.

Getting an accurate reading

A phone's compass is a small magnetic sensor, and it is easily disturbed. For the best reading:

  1. Hold the phone flat, screen facing up, and keep it level while you turn.
  2. Step away from metal and electronics. Steel tables, radiators, laptops, speakers, magnetic phone cases and car dashboards can pull the reading off by many degrees.
  3. Calibrate if the direction jumps around. Move the phone slowly in a figure of eight a few times. Quba shows a reminder when the phone reports that its compass accuracy is low.
  4. Check against something you know. If you know which way your street or a nearby mosque faces, compare the two. A large difference usually means interference nearby.

If your phone has no compass, Quba shows the Qibla as a number of degrees from north instead. You can then find it with a separate compass, or from the sun: at midday in the northern hemisphere it lies roughly due south.

When you are travelling

The Qibla changes as you move, so after a long journey update your location in the app, or pick your new city. On a plane or in a moving car the compass is unreliable. Find the direction once you have arrived, or estimate it from the table above.

Scholars have long held that someone who cannot see the Kaaba should face its direction as best they can. A small error made in good faith does not spoil the prayer. The compass is there to help you face it with confidence, not to make you anxious about a degree or two.

Questions about the Qibla compass are also answered on the support page.