How Is the Qibla Direction Calculated? Why the Line on the Map Looks Curved

Most people looking at a qibla map for the first time notice the same thing: the line between their location and the Kaaba is not straight but curved. Someone in New York meets an even stranger result — the qibla points north-east, while Mecca sits to the south-east on the map. Neither is a mistake. The reason is that the earth is a sphere and a map is a plane.

The qibla is a direction, not a route

The qibla bearing is the initial direction of the shortest path from where you stand to the Kaaba, measured in degrees clockwise from true north. Zero is north, ninety is east, one hundred and eighty is south, two hundred and seventy is west. The key word is initial: as you travel along a sphere the bearing gradually changes, but what matters for prayer is the direction from where you are standing.

The Kaaba's coordinates and the calculation itself

The calculation uses the latitude and longitude of two points. The Kaaba lies at 21.4225 degrees north and 39.8262 degrees east. The formula comes from spherical trigonometry: the sine and cosine of the difference in longitude are combined with the sines and cosines of the two latitudes, and the arctangent of the result is taken. That gives a value between minus one hundred and eighty and plus one hundred and eighty, which is normalised modulo three hundred and sixty into a compass bearing. The same formula works for every point on earth.

The earth is a sphere, so the shortest path is a great circle

On a sphere, the shortest path between two points is the arc cut by the plane passing through both points and the centre of the sphere. This is called a great circle. The equator is a great circle, and so is every line of longitude, but lines of latitude other than the equator are not. This is why flights from Europe to America pass over Greenland: that route looks longer on a map yet is genuinely the shortest.

So why does the map show a curve?

Common maps use the Mercator projection. It preserves angles but distorts areas and distances, and the distortion grows towards the poles, which is why Greenland appears as large as Africa. If you draw a straight line on a Mercator map you get the path of a constant compass bearing. That path really is straight, but it is not the shortest. The great circle, which is the shortest, looks curved once projected onto a flat surface. The curvature is in the map, not in reality.

Why is the qibla north-east from New York?

The qibla bearing for New York is 58.5 degrees, that is north-east, and the distance to the Kaaba is 10,307 kilometres. On a sphere the shortest path from New York to Mecca runs north-east across the North Atlantic, not south-east. You can verify this yourself on a globe with a piece of string: stretch it between the two points and you will see it bend northward. The same surprise appears in the southern hemisphere: the qibla from Johannesburg is 14.6 degrees, almost due north.

Real bearings from a few cities

Some examples from the calculations on this site: Istanbul 151.6 degrees and 2,405 kilometres; London 119 degrees and 4,794 kilometres; Almaty 246.7 degrees and 4,195 kilometres; Dhaka 277.6 degrees and 5,172 kilometres; Jakarta 295.2 degrees and 7,921 kilometres; Tokyo 293 degrees and 9,475 kilometres; New York 58.5 degrees and 10,307 kilometres; Johannesburg 14.6 degrees and 5,446 kilometres. As you can see the qibla is not south-east everywhere; it depends on where Mecca lies relative to you.

How is the distance calculated?

The distance to the Kaaba is the length of that same great-circle arc, computed with the haversine formula. In essence it finds the central angle between the two points and multiplies it by the radius of the earth. The result is the straight-line distance across the surface; a road journey or a flight path will always be longer.

True north or magnetic north?

The bearing this calculation gives is relative to true north. The compass in your hand points to magnetic north, and the difference between the two varies with where you are. If you intend to use a compass you must account for that difference; otherwise you can be off by anything from a few degrees to fifteen, depending on the city.

How QiblaTap calculates it

For every city we compute the great-circle initial bearing and present it relative to true north. The same page also states the bearing you should read on a magnetic compass and the magnetic declination for that city. The line in the map view is a genuine great-circle arc rather than a straight segment, which is why it visibly bends for some cities. When you see a curve, you are not looking at a drawing error but at the real geometry of the earth.

→ Qibla Direction Finder — Live Qibla Compass