Qibla Direction Calculator
Calculate a spherical Qibla bearing clockwise from true north using entered coordinates and the published Selangor/JAKIM reference.
Find the initial great-circle direction toward a published Kaaba reference from your latitude and longitude. The answer is an angle clockwise from true geographic north. This coordinate calculation does not access your location, rotate a device compass or establish a surveyed prayer line.
How to use this tool
- Enter decimal-degree latitude, with south represented by a negative number.
- Enter decimal-degree longitude, with west represented by a negative number.
- Read the bearing clockwise from true north, using a correctly oriented map or independently corrected compass.
- For locations close to the Kaaba, use a locally established direction instead.
Formula
Bearing = atan2[sin(Δλ) cos(φ₂), cos(φ₁) sin(φ₂) − sin(φ₁) cos(φ₂) cos(Δλ)], normalized to 0–360°.
Here φ₁ is your latitude, φ₂ is the reference latitude and Δλ is reference longitude minus your longitude. The reference is 21°25′15.6″ N, 39°49′29.1″ E, as published in the Selangor/JAKIM teaching example. The Earth is modeled as a sphere.
Example
The official Shah Alam example uses 3°05′ N and 101°35′ E. Its reported direction is about 292°34′38.5″ clockwise from north, displayed here as 292.6°. This points west-northwest; it is not a magnetic compass reading.
Frequently asked questions
Why can the direction look surprising on a flat map?
The shortest spherical route follows a great circle. Its initial bearing need not match a straight line drawn on a particular flat map projection.
Can I use the number directly on a magnetic compass?
Only after accounting for local magnetic declination and compass error. This calculator supplies neither of those corrections.
Why are some locations rejected?
A bearing is undefined at the reference and its antipode, and geographic north is ambiguous at a pole. The reference model also excludes locations within 50 km, where a coarse published coordinate is unsuitable for local alignment.
Sources
Last updated: 2026-10-30