Qibla Direction
{{ headingDisplay }}
{{ bearingInstruction }}
{{ cardinalDirection }} {{ referenceLabel }} {{ distanceDisplay }} Declination {{ signedNumber(declination_deg, 1) }}° {{ radiusLabel }}
Qibla direction inputs
Use decimal degrees from -90 to 90; north is positive.
Use decimal degrees from -180 to 180; east is positive.
Browser GPS fills the decimal coordinate fields when permission is granted.
True north is the default; magnetic mode needs a local declination value.
Accepted range -30° to +30°; enter west declination as a negative value.
°
Enter valid coordinates to compute Qibla direction.
{{ geoError }}
Use heading degrees: 0 north, 90 east, 180 south, 270 west.
°
Mean is the normal choice; equatorial or polar adjusts the reported kilometer distance.
Choose 1-4 decimal places; calculations keep full precision internally.
Field Value Copy
{{ row.label }} {{ row.value }}
Open OSM
Step Guidance Copy
{{ row.step }} {{ row.guidance }}

                
Customize
Advanced
:

Introduction

Qibla is the prayer direction toward the Kaaba in Makkah. Away from Makkah, that direction is not a flat left-or-right guess from a wall map. It is a bearing from north to the Kaaba from your own location, and it changes as soon as your latitude or longitude changes.

That is why people in Kuala Lumpur usually face west-northwest, people in London face southeast, and people in New York face east-northeast. The destination stays the same, but the starting direction across the Earth's surface changes from place to place. Bearing-based qibla guidance is most useful when you are setting a prayer spot at home, checking a hotel room, or confirming the orientation of a temporary prayer area while traveling.

A compass adds one more layer. True north is geographic north. Magnetic north is where a compass needle points, and the gap between the two is magnetic declination. That gap changes with location and over time, so a compass-ready heading needs the right declination for the place where you are standing.

Precision helps, but it is not the only thing that matters. Indoor metal, phone sensor drift, approximate coordinates, and room layout can all affect how confident you should feel about a single reading. The better habit is to combine the heading with a quick location check and a sensible north reference before you commit to the final alignment.

Technical Details

The heading here is an initial great-circle bearing from the observer to the Kaaba. In plain terms, it is the clockwise angle from true north at your location to the shortest path over the Earth's surface toward the Kaaba. That is why the result is location-specific and why a flat map can look visually different from the numeric heading.

Distance is derived separately from direction. The calculation first finds the central angle between the two points on a spherical Earth model. It then multiplies that angle by the selected Earth radius. Because of that separation, changing the radius model can nudge the reported distance while leaving the bearing unchanged.

Core formulas used by the page

delta_lon = kaaba_lon - user_lon

true_bearing = atan2(sin(delta_lon) * cos(kaaba_lat), cos(user_lat) * sin(kaaba_lat) - sin(user_lat) * cos(kaaba_lat) * cos(delta_lon))

central_angle = 2 * atan2(sqrt(a), sqrt(1 - a))

distance = Earth_radius * central_angle

magnetic_bearing = true_bearing - declination when east declination is entered as a positive value.

Qibla inputs, constants, and what each one changes
Item Meaning What it changes
Kaaba coordinates Fixed at 21.422487, 39.826206 Destination point for every bearing and distance
Latitude and longitude Your position in decimal degrees True bearing, magnetic bearing, distance, central angle, and map placement
North reference True north or magnetic north The active heading shown in the summary and plan
Magnetic declination Difference between magnetic and true north, east positive Magnetic heading only; it does not change the true bearing
Current facing Your present heading in degrees Turn instruction only; qibla itself stays the same
Earth radius model Mean, equatorial, or polar Earth radius Reported distance only; headings stay fixed
Precision digits Display rounding from 1 to 4 decimals Formatting only; no change to the underlying geometry

The page also separates the qibla direction from your own orientation. Current facing is not part of the qibla calculation. It is used only after the heading is known, so the result can say whether to turn left, turn right, or hold your position. That separation is useful because it lets you distinguish a wrong north reference from a wrong body orientation.

There are still limits. Near the poles, both compass declination and bearing stability become harder to treat as everyday guidance. At the exact destination point, direction loses meaning because the starting point and target collapse into the same place. For normal household and travel use, though, the more common failure points are simpler: inaccurate coordinates, the wrong declination sign, or a compass reference that does not match the heading you are reading.

Everyday Use & Decision Guide

Start with the best location fix you can get. If browser geolocation works, the GPS button is the fastest clean first pass. If you are indoors, permission is blocked, or the fix looks vague, enter decimal latitude and longitude from a map app or trusted map source instead. The heading is only as good as the location behind it.

Keep the north reference on true north unless you are deliberately matching a physical compass or a compass app. Magnetic mode is for the case where the instrument in your hand follows magnetic north. Enter east declination as positive and west declination as negative. A sign mistake pushes the active heading to the wrong side by about twice the local declination, which is large enough to matter in a room.

  • Bearing Plan is the best first stop because it puts the active heading, both bearing types, turn guidance, distance, and the central-angle context in one place.
  • Kaaba Line is the fastest sanity check when the number feels surprising. If the markers are wrong, the heading will be wrong too.
  • Prayer Setup turns the result into short copyable steps for a home corner, hotel room, office, classroom, or temporary prayer space.
  • JSON, CSV, and DOCX exports are useful when you want a repeatable record for site notes, facilities planning, or group instructions.

Use the current facing field when you want left-or-right turn guidance instead of just a final heading. If you leave it at 0, the page still gives the target direction, but the turn instruction is no longer about your actual body position. Before trusting that final instruction, confirm that the active heading matches the north reference you chose and that the map marker sits on the place where you are really standing.

Step-by-Step Guide

  1. Enter decimal latitude and longitude, or use the GPS button if the browser can detect your position.
  2. Add your current facing if you want a personalized left-or-right turn instruction instead of only the final qibla heading.
  3. Choose True north for map-style orientation or Magnetic north if you will follow a compass.
  4. If you choose magnetic north, open Advanced and enter the local declination with east as positive and west as negative.
  5. Leave the Earth radius on Mean radius unless you have a specific reason to compare distance models, then set the display precision you want.
  6. Read Bearing Plan first, then open Kaaba Line to confirm the two endpoints, and Prayer Setup if you want a short checklist you can copy or export.
  7. Use CSV, DOCX, or JSON export when you need to keep the setup for later use or share it with someone else.

Interpreting Results

The most important field is the active heading in the summary. That is the direction to follow from the north reference you selected. The page also shows the true bearing and magnetic bearing separately in the plan, which lets you confirm whether declination is being applied the way you expect.

How to read the main qibla outputs
Output What it means Best trust-check
Active heading The final angle to follow from the selected north reference Make sure the reference badge matches the instrument you are using
True bearing The geographic direction from true north Use it when you are aligning from a map or another true-north method
Magnetic bearing The compass-ready heading after declination is applied If it looks wrong, check the declination value and its sign first
Turn guidance How far left or right to rotate from your current facing If the direction feels reversed, verify the current facing entry and north reference
Cardinal direction A rounded 16-point label such as ENE or WNW Use it for quick speech, not for fine alignment
Great-circle distance The surface distance implied by the selected radius model Useful for context only; it does not tell you whether the room alignment is correct
Central-angle arc The angular separation between your location and the Kaaba at Earth's center It should stay the same when you change the Earth radius model

A long decimal heading can look more certain than it really is. The precision selector changes how many decimals are shown, not how accurate your location fix or compass is. If the heading changes after you switch only the radius model or only the display precision, something else changed with it and the setup should be checked again.

The simplest false-confidence warning is this: a clean number is not proof that the room is aligned. If the active heading, the map position, and your physical compass do not agree, stop and verify coordinates, declination sign, and current facing before you follow the turn instruction.

Worked Examples

Example 1: Kuala Lumpur with true north

At 3.1390, 101.6869, the true bearing is about 292.54°, which rounds to a WNW cardinal label. The distance is about 6,973.9 km and the central angle is about 62.72°. If you are currently facing 0°, the turn instruction is to rotate about 67.5° left. This is a good everyday example of why much of Southeast Asia points generally westward toward Makkah.

Example 2: London with a magnetic compass

At 51.5074, -0.1278, the true bearing is about 118.99°. If local declination is entered as +1.2° east and the page is switched to magnetic north, the active heading becomes about 117.79°. If you are facing 90°, the turn guidance becomes about 27.8° to the right. This is the typical case where magnetic correction is modest but still worth applying when you are following a compass rather than a map.

Example 3: Troubleshooting a compass mismatch

Suppose your local declination is 5° east, but you accidentally enter it as 5° west. The page should subtract 5° from the true bearing, yet the wrong sign makes it add 5° instead. That creates a 10° spread between the correct magnetic heading and the one on screen.

When the map placement looks right but the compass result feels off by roughly twice the declination, fix the sign first. If the mismatch remains, step away from metal objects, recalibrate the compass source you are using, and confirm that your current facing entry still matches how you are actually standing.

FAQ:

Should I use true north or magnetic north?

Use true north when you are aligning from a map, survey line, or another true-north reference. Use magnetic north when the reading in your hand comes from a compass and you have entered the local declination.

Why does changing the Earth model alter distance but not the heading?

The page calculates the direction and the central angle first. Distance is then derived by multiplying that angle by the selected Earth radius. Because the angle is unchanged, the heading stays the same while distance shifts slightly.

What if GPS is unavailable or permission is denied?

Enter decimal latitude and longitude manually. The page does not require GPS as long as you can provide the coordinates yourself.

Does the map view replace the numeric heading?

No. The map is a visual check that marks your position, the Kaaba, and a connecting line between them. The heading in the summary and Bearing Plan remains the directional result to follow.

Does my location leave the browser?

The qibla math runs in the browser. If you use geolocation, the browser handles that permission locally. If you open the map, your browser requests map tiles from OpenStreetMap, and the OpenStreetMap button opens that service directly in a new tab.

What does "already aligned" mean?

It means your current facing is within about 1° of the selected qibla heading. That is a convenience threshold for the turn instruction, not a claim of survey-grade accuracy.

Glossary:

Qibla
The direction of prayer toward the Kaaba in Makkah.
True bearing
The clockwise angle from geographic north to the Kaaba from your location.
Magnetic bearing
The compass-oriented version of the heading after magnetic declination is applied.
Magnetic declination
The local angle between magnetic north and true north, entered here with east as positive.
Great-circle
The shortest path between two points on a sphere's surface.
Central angle
The angle between two surface points as measured from the Earth's center.

References: