Calculate

Calculate

Getting your location…

Align with Qibla

Hold the phone flat, then enable the compass.

°
°

Updates as you type

Result

—

The formula

Qibla is the initial bearing on the sphere from your coordinates to the Kaaba (about 21.4225°N, 39.8262°E). The compass compares that bearing with your phone’s heading so you can face Makkah.

θ = atan2(sinΔλ·cosφ₂, cosφ₁·sinφ₂ − sinφ₁·cosφ₂·cosΔλ)

Worked example

  1. Sofia ≈ 42.6977°N, 23.3219°E
  2. Great-circle bearing to the Kaaba ≈ 142° from true north
  3. Turn until the phone faces that heading

Result: Qibla ≈ 142° (southeast from Sofia)

How qibla direction is calculated

The tool uses a spherical Earth model and the Kaaba’s published coordinates. Local mosque markers may differ slightly because of magnetic declination, building layout, or official adjustments.

Great-circle bearing

Using your latitude and longitude and the Kaaba’s coordinates, we compute the forward azimuth — the direction you would start traveling on the shortest path on the globe.

True north vs magnetic compass

Device compasses sense magnetic north. Declination (the angle between magnetic and true north) varies by place and year. For precise mosque alignment, confirm with a local qibla indicator; this page is a planning aid.

Phone orientation

Hold the phone flat. On iOS, motion permission is required before compass events fire. Metal cases and nearby magnets can skew readings.

What we do not claim

We do not replace a surveyed mosque qibla or a calibrated professional compass. Treat the result as an estimate and follow your community’s guidance when they differ.

Interesting facts

One Kaaba, many bearings

From New York the qibla is roughly northeast; from Jakarta it is northwest. The same destination produces different headings worldwide.

Not the same as East

In many places people loosely say “face east,” but qibla is toward Makkah — often tens of degrees away from due east.

Declination matters indoors

City buildings and phone magnets can pull a digital compass off by several degrees even when the math is correct.

Spherical vs ellipsoidal

A sphere is accurate enough for everyday facing; geodesic libraries on the WGS84 ellipsoid change the bearing by fractions of a degree for most cities.

Pairs with prayer times

Once you know when to pray, the next practical question is which way to face — this calculator answers that from the same location idea.

Frequently asked questions

Open this page, allow location, tap Enable compass, hold the phone flat, and turn until Qibla lines up with the top marker. The readout shows how many degrees to turn.

It is degrees clockwise from true north: 0° north, 90° east, 180° south, 270° west. Facing that heading points you toward the Kaaba along the great-circle path.

Mosques may use magnetic bearings, city-standard charts, or surveyed lines that include small safety offsets. Differences of a few degrees are common — follow the mosque mark for congregational prayer.

A location is required for the bearing. GPS is requested on this page; if you decline, enter latitude and longitude manually.

Across a typical metro area the bearing barely changes. Only very large east–west spans shift it by about a degree.

You still get the numeric bearing from north. Without a compass sensor you must orient yourself with a map or another compass.

References

  1. Kaaba geographic coordinates (common reference) — Islamic geographic / mapping practice Widely used destination point for qibla bearing tools (~21.42°N, 39.83°E).
  2. Forward azimuth on a sphere — Movable Type Scripts / standard navigation formulary Documents the atan2 initial-bearing formula used in navigation.

Informational geographic estimate only — not a religious ruling. Prefer your mosque’s qibla mark for worship.

Last reviewed: 2026-09-30 — Reviewed by: Editorial Team

Embed this calculator

Add this calculator to your website with a free iframe widget.

Theme

The widget stretches to the width of its container and adjusts its height automatically.