Sri Lanka Qibla Direction Finder
Find the exact Qibla — the direction to the Kaaba in Makkah — from any city in Sri Lanka. Get the true-north bearing in degrees, a live rotating compass, and the distance to Makkah. Free, no signup, computed in your browser.
How it works
The Qibla is the direction a Muslim faces during prayer: the shortest-path (great-circle) direction from where you stand to the Kaaba in Makkah, at latitude 21.4225°N and longitude 39.8262°E. On a sphere the shortest route between two points is an arc of a great circle, and the direction you set off in — the initial bearing or forward azimuth — is the Qibla. Because that arc bends toward the pole, the direction from Sri Lanka is west-northwest rather than due west.
Let your position be latitude φ₁, longitude λ₁ and the Kaaba be φ₂, λ₂. The tool converts everything to radians and applies the standard initial-bearing formula:
Δλ = λ₂ − λ₁ y = sin(Δλ) · cos(φ₂) x = cos(φ₁) · sin(φ₂) − sin(φ₁) · cos(φ₂) · cos(Δλ) θ = atan2(y, x) bearing = (θ° + 360) mod 360
The result is the angle clockwise from true north, from 0° to 360°. A 16-point compass label (N, NNE, … WNW, NW) is assigned by rounding the bearing to the nearest 22.5°. To prove the number, the tool independently recomputes it with the classic Qibla cotangent form — θ = atan2(sin Δλ, cos φ₁ · tan φ₂ − sin φ₁ · cos Δλ) — which is the same great-circle bearing rearranged, and confirms both agree to within 0.01°.
The distance to Makkah uses the haversine formula on a sphere of mean radius R = 6,371.0088 km: a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2), then d = 2R · asin(√a). For Colombo this gives 4,589 km.
One caveat: bearings are relative to true north, the geographic pole. A magnetic compass points at magnetic north, which in Sri Lanka sits about 1–2° west of true north (the NOAA World Magnetic Model declination). That gap is far too small to affect the validity of prayer, so the tool reports the true bearing and notes the correction rather than bundling a magnetic model. When a phone exposes a live compass heading, the dial rotates so you can turn to face the Qibla directly.
Worked examples
Frequently asked questions
Sources & references
- Kaaba geographic coordinates (21.4225°N, 39.8262°E) — Wikipedia
- Great-circle bearing & haversine distance formulas — Chris Veness, Movable Type Scripts
- Magnetic declination (true vs magnetic north) — NOAA/NCEI World Magnetic Model
Bearings for Colombo, Kandy, and Jaffna were last cross-checked against IslamicFinder and Aladhan Qibla output on 2026-07-09 — all within ±0.2°. The great-circle method matches the convention used by every mainstream Qibla service.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.