2026-09-08
The Great Circle: How the Qibla Angle Is Actually Calculated
Every qibla app produces a number: 58 degrees in New York, 119 in London, 137 in Berlin. That number is not looked up in a table; it is computed, and the computation is old, well understood and identical in every honest implementation. Understanding it explains several things that otherwise seem strange.
The definition
The qibla is the initial bearing of the great-circle path from your position to the Kaaba at 21.4225 degrees north, 39.8262 degrees east. A great circle is the intersection of a sphere with a plane through its centre — the shortest route between two points on a sphere. The word initial matters: on a long great-circle route the bearing changes continuously as you travel. What you face is the bearing at your starting point.
The formula
Given your latitude and longitude and those of the Kaaba, the bearing is the arctangent of two quantities. The numerator is the sine of the longitude difference multiplied by the cosine of the Kaaba's latitude. The denominator is the cosine of your latitude times the sine of the Kaaba's latitude, minus the sine of your latitude times the cosine of the Kaaba's latitude times the cosine of the longitude difference. The result, converted to degrees and normalised to a range of zero to 360, is the qibla. No approximation and no lookup table is involved.
Why the bearing changes as you move
Because the formula depends on both your latitude and your longitude, the answer changes with every kilometre. Berlin gives 137 degrees and Cologne 127 — ten degrees apart across a distance you can drive in five hours. In the United States the spread is even wider: New York 58 degrees, Chicago 49, Seattle 18. This is why a single national figure is meaningless and why every city needs its own value.
Great circle versus rhumb line
There is a second way to define a direction on a sphere: the rhumb line, which holds a constant compass bearing the whole way. On a flat map it looks like a straight line, which is why it seems intuitive. But it is not the shortest path, and over ten thousand kilometres the two answers diverge sharply — from North America the rhumb line points southeast while the great circle points northeast. Essentially all contemporary practice uses the great circle.
How accurate is the result?
Treating the Earth as a perfect sphere introduces an error of well under a degree — the Earth's flattening is about one part in three hundred. Using an ellipsoidal model changes the answer by a fraction of a degree, far less than the error of any phone compass. The limiting factor in practice is never the mathematics; it is the sensor and the environment you measure in.
From true north to your compass
The computed bearing is measured from true north. A magnetic compass points at the magnetic north pole instead, and the difference — magnetic declination — varies from place to place and drifts slowly over years. In the continental United States it ranges from roughly fifteen degrees east on the Pacific coast to about fifteen degrees west in the Northeast. That correction is larger than the entire error budget of the qibla calculation, so it is worth getting right. Every city page gives the corrected magnetic reading alongside the true bearing.