Qibla Direction Finder | Compass & GPS

Read a great-circle bearing relative to true north and check how compass directions wrap at north.

Quick Answer

The Qibla bearing is the initial great-circle direction from your location to the Kaaba. Use latitude and longitude for a true-north bearing, and account for magnetic declination if you use a magnetic compass.

Navigation compass beside a globe

Qibla Direction Finder

Find the Qibla direction from any latitude and longitude using spherical trigonometry. Use GPS, city presets, manual coordinates, true-north bearing, optional magnetic-declination correction, great-circle distance, compass guidance, and MathJax-rendered formulas. Use the geodesic bearing calculator to compare the initial and final directions along a long-distance route.

GPS location Manual coordinates City presets True north bearing Magnetic compass correction Kaaba distance DMS coordinates Compass SVG Device orientation Copy result

1. Enter Your Location

Advanced Options

kilometres

East positive, west negative. Example: +2.5 means 2.5° east.

GPS status: Manual mode. Use GPS on HTTPS for automatic coordinates.

2. Qibla Direction Result

Qibla bearing from your location 258.330°

Direction from Dubai, UAE to the Kaaba, measured clockwise from true north.

True Bearing 258.330°
Compass Bearing 258.330°
Direction WSW
Distance 1,637 km
N S W E NE SE SW NW Qibla: 258.330° from true north Green arrow points toward the Kaaba
Live compass: not started. On phones, allow motion/orientation permission, hold the device flat, and avoid magnetic interference.

3. Detailed Qibla Calculation

Measurement Meaning Current Result
True Qibla bearing Angle clockwise from geographic north. 258.330°
\[ \theta = \operatorname{atan2} \left( \sin(\Delta\lambda)\cos(\varphi_K), \cos(\varphi)\sin(\varphi_K)-\sin(\varphi)\cos(\varphi_K)\cos(\Delta\lambda) \right) \]

Qibla Direction Finder Formulas

The Qibla direction is calculated as the initial great-circle bearing from the user’s location to the Kaaba. Latitude is represented by \(\varphi\), longitude by \(\lambda\), the Kaaba latitude by \(\varphi_K\), and the Kaaba longitude by \(\lambda_K\). All trigonometric calculations must use radians.

\[ \Delta\lambda = \lambda_K-\lambda \] \[ y=\sin(\Delta\lambda)\cos(\varphi_K) \] \[ x=\cos(\varphi)\sin(\varphi_K)-\sin(\varphi)\cos(\varphi_K)\cos(\Delta\lambda) \] \[ \theta=\operatorname{atan2}(y,x) \] \[ B_{\text{true}}=(\theta \times 180/\pi + 360)\bmod 360 \]

The result \(B_{\text{true}}\) is the Qibla bearing measured clockwise from true north. A value of \(0^\circ\) means due north, \(90^\circ\) means due east, \(180^\circ\) means due south, and \(270^\circ\) means due west.

The distance to the Kaaba is calculated with the haversine formula:

\[ a= \sin^2\left(\frac{\Delta\varphi}{2}\right) + \cos(\varphi)\cos(\varphi_K) \sin^2\left(\frac{\Delta\lambda}{2}\right) \] \[ c=2\operatorname{atan2}(\sqrt{a},\sqrt{1-a}) \] \[ d=R c \]

If you are using a magnetic compass instead of a GPS compass or map-based true-north reference, magnetic declination can be applied manually:

\[ B_{\text{magnetic}}=(B_{\text{true}}-D+360)\bmod 360 \]

In this formula, \(D\) is magnetic declination in degrees. Use east declination as positive and west declination as negative. Magnetic declination changes by location and time, so the calculator does not guess it automatically. Enter the value from a reliable local compass or geophysical reference if you need magnetic-compass guidance.

Complete Guide to Finding the Qibla Direction

The Qibla is the direction Muslims face during Salah. A Qibla direction finder is a mathematical and practical tool that helps estimate the direction from a user’s current position to the Kaaba in Makkah. For everyday use, the key output is a bearing: an angle measured clockwise from north. For example, a Qibla bearing of \(258^\circ\) means the direction is slightly south of west, while a bearing of \(58^\circ\) means the direction is northeast. The exact direction changes depending on where the user is located on Earth.

The calculator on this page uses latitude and longitude. Latitude tells how far north or south a place is from the equator. Longitude tells how far east or west a place is from the prime meridian. Once your coordinates are known, the calculator compares them with the coordinates of the Kaaba and calculates the initial direction of the great-circle path. This is the mathematically standard way to calculate the shortest route between two points on the surface of a spherical Earth model. Use the latitude and longitude format converter to put both coordinate pairs into the same format before comparing them.

The phrase “initial bearing” is important. A great-circle route is the shortest path on a sphere, but it may not appear as a straight line on a flat world map. Flat maps distort the curved surface of Earth. In some regions, a line that looks southeast on a rectangular map may actually begin northeast when measured along the globe. This is why Qibla direction tools use spherical trigonometry rather than simply drawing a straight line on a flat map. Use the map distance and scale calculator to convert the length measured on a map to a ground distance.

In practical terms, this Qibla finder gives three useful numbers. First, it gives the true Qibla bearing, which is the direction from true north. Second, it gives the magnetic-compass bearing if you enter magnetic declination. Third, it gives the approximate great-circle distance from your location to the Kaaba. The distance is not needed to face the Qibla, but it helps explain the geometry and confirms that the calculation is using the correct destination.

True north and magnetic north are not the same. True north points to the geographic North Pole. Magnetic north points toward Earth’s magnetic field direction, and it changes by location. A phone GPS map or satellite map usually works with true-north style geographic coordinates. A traditional magnetic compass points toward magnetic north unless it has been corrected. If your local magnetic declination is \(+3^\circ\) east, then a true bearing can be converted to a magnetic bearing by subtracting 3 degrees. If your local declination is \(-5^\circ\) west, subtracting the negative value is the same as adding 5 degrees.

Phone compasses can be useful, but they are not perfect. A phone may be affected by nearby metal objects, magnetic phone cases, speakers, laptops, cars, electrical wiring, reinforced concrete, elevators, and other interference. Calibration also matters. If the live compass arrow jumps or drifts, move away from magnetic interference, hold the phone flat, rotate the phone slowly, and compare with a known direction such as sunrise, a map, or a reliable physical compass.

GPS location also has limitations. In dense urban areas, tall buildings can reduce accuracy. Indoors, GPS may rely on Wi-Fi and cell-tower estimation instead of satellite signals. A location error of a few metres normally does not create a meaningful Qibla direction error, but if the device reports a very inaccurate location, the result should be checked manually. This calculator shows GPS accuracy when the browser provides it.

The city preset list is included for convenience. It is useful for quick examples, classroom demonstrations, travel planning, and testing the formulas. However, for the most accurate result, use your exact latitude and longitude or GPS location. A city coordinate represents a central point, not every building in that city. In a large city, the Qibla bearing may differ slightly between districts.

The Qibla angle is measured clockwise from north. This convention is common in navigation. North is \(0^\circ\), east is \(90^\circ\), south is \(180^\circ\), and west is \(270^\circ\). A direction of \(45^\circ\) is northeast. A direction of \(135^\circ\) is southeast. A direction of \(225^\circ\) is southwest. A direction of \(315^\circ\) is northwest. The compass label in this tool converts the exact angle into a familiar 16-point direction such as NNE, ENE, WSW, or SSW.

The mathematical method uses spherical trigonometry. Imagine a triangle drawn on the globe. One point is your location, one point is the Kaaba, and one point is the North Pole. The angle at your location between the north direction and the great-circle route to the Kaaba is the Qibla angle. Because the triangle lies on the surface of a sphere, ordinary flat-triangle formulas are not enough. Spherical formulas account for Earth’s curvature.

The bearing formula uses \(\operatorname{atan2}\), not ordinary tangent alone. The reason is quadrant accuracy. A tangent value by itself can repeat in different quadrants, but a bearing must distinguish northeast from southwest and northwest from southeast. The \(\operatorname{atan2}(y,x)\) function uses both components to place the angle in the correct direction. After converting from radians to degrees, the result is normalized into the range \(0^\circ\) to \(360^\circ\).

The distance formula uses the haversine method. The haversine formula is popular in navigation because it is stable for many practical distances on a spherical model. It calculates the central angle between two points using latitude and longitude, then multiplies that angle by Earth’s radius. The result is an approximate great-circle distance. This is not the same as road distance or air-route distance, but it is the curved-surface distance on the Earth model. Use the distance calculator to work out the separation before thinking about the direction.

A common user question is whether the Qibla should be shown as a straight line on a map. The answer depends on the map projection. On a globe, the great-circle path is the shortest route. On a flat Mercator-style map, the same route may curve. If a map draws a straight line between your city and Makkah, that line may represent a rhumb line rather than a great-circle bearing. For Qibla calculation, the great-circle initial bearing is the standard mathematical choice used by most modern tools.

Another common question is whether small errors matter. In everyday prayer settings, a very small numerical error is normally not practically visible. A difference of one or two degrees can be difficult to distinguish without instruments. Larger errors can happen if a compass is affected by magnetic interference, if a map is read incorrectly, or if a city direction is guessed from a flat map. This is why a calculator is useful: it removes much of the guesswork.

If you are setting the direction for a mosque, prayer room, office musalla, school prayer space, or public worship area, use more than one verification method. Check GPS coordinates, use a reliable map, verify true north, consider local magnetic declination if using a compass, and consult knowledgeable local mosque leadership or specialists if required. This calculator is built for education, personal use, and planning; permanent architectural alignment deserves careful verification.

The calculator’s manual coordinate option is useful when GPS is unavailable. You can obtain latitude and longitude from a map app, GPS receiver, survey record, travel location, or address lookup. Use decimal degrees. North latitude is positive, south latitude is negative, east longitude is positive, and west longitude is negative. For example, a location at \(25.2048^\circ\) north and \(55.2708^\circ\) east is entered as latitude 25.2048 and longitude 55.2708. A location in New York uses a negative longitude because it is west of Greenwich.

DMS format means degrees, minutes, and seconds. This calculator displays decimal coordinates in DMS form to make the result easier to compare with some maps or GPS devices. One degree has 60 minutes, and one minute has 60 seconds. Decimal degrees are usually easier for web calculators and programming, while DMS is common in older navigation references.

The live compass feature uses the device orientation sensor if the browser allows it. On many phones, the browser requires HTTPS and a direct user gesture before it will share orientation data. Some browsers provide absolute compass heading; others provide relative orientation or incomplete sensor data. Because browser support varies, the calculator still works fully with manual bearing output even when live compass data is unavailable. Use the digital compass and heading tool to compare a calculated bearing with the direction you are facing.

The green arrow in the SVG compass shows the Qibla direction. The dashed orange arrow represents the phone’s live heading when orientation data is available. If the tool says “turn right,” rotate the device clockwise. If it says “turn left,” rotate the device counterclockwise. When the difference is small, the display indicates that the phone is aligned toward the Qibla. This should be treated as convenient guidance, not a laboratory-grade instrument.

The Qibla direction can also be understood through applied mathematics lessons. Students can learn about angles, degrees, radians, trigonometric functions, latitude, longitude, coordinate systems, spherical geometry, distance formulas, and compass bearings. This makes the Qibla finder a useful real-world math application for geometry, navigation, geography, astronomy history, and web development.

From a web development perspective, this calculator works without a paid map API. It uses browser geolocation when the user permits it, manual coordinate entry when GPS is unavailable, and JavaScript trigonometry for the bearing and distance. The SVG compass is drawn directly in the page, so it remains visible and responsive on desktop and mobile screens. The formulas are rendered with MathJax to keep the mathematical explanation clean.

Privacy is also important. This calculator does not need to store a user’s location. If GPS is used, the browser asks for permission and provides the position to the page. The calculation can happen locally in the browser. Users who do not want to share GPS location can enter coordinates manually or select a city preset. For a public website, it is good practice to explain this clearly.

There is no universal “score table,” “score guideline,” or “next exam timetable” for a Qibla direction finder. This is not an academic score calculator. It is a mathematical direction and navigation tool. It can support lessons in trigonometry, geography, applied mathematics, and measurement, but official exam schedules and grading rules must come from the relevant school, board, or examination authority.

Accuracy note: Qibla direction is calculated mathematically from coordinates. Real-world alignment can still be affected by GPS accuracy, phone compass calibration, magnetic interference, local magnetic declination, room layout, map projection misunderstanding, and manual measurement error. Use multiple checks for permanent prayer spaces.

How to Use the Qibla Direction Finder

  1. Choose your location method. Use GPS, select a city preset, or manually enter latitude and longitude.
  2. Check the coordinate format. Latitude must be between \(-90^\circ\) and \(90^\circ\); longitude must be between \(-180^\circ\) and \(180^\circ\).
  3. Click Find Qibla Direction. The tool calculates the bearing from your location to the Kaaba.
  4. Read the true bearing. This is the angle clockwise from geographic north.
  5. Use magnetic correction if needed. Enter local magnetic declination if using a traditional magnetic compass.
  6. Use the compass diagram. The green arrow shows the Qibla direction.
  7. Use live compass carefully. On a phone, allow orientation permission, hold the device flat, and avoid metal objects or magnets.
Feature What It Does Best Use
GPS Location Uses browser geolocation permission to fill latitude and longitude. Best for personal location accuracy on mobile.
Manual Coordinates Lets users enter decimal latitude and longitude directly. Best for desktop users, privacy-conscious users, and exact coordinates from a map.
City Presets Loads approximate central coordinates for common cities. Best for examples, quick checks, and educational demonstrations.
True Bearing Shows angle from geographic north. Best for GPS maps, satellite maps, and mathematically correct Qibla direction.
Magnetic Bearing Applies manual magnetic-declination correction. Best when using a traditional magnetic compass.
Live Compass Uses phone orientation data when supported by the browser. Best for mobile guidance, but should be checked for calibration and interference.

Score, Course, and Exam Table Note

Requested Item Status for This Qibla Tool Correct Guidance
Score guidelines Not applicable This is a direction and applied-math calculator, not an official score calculator.
Score table Not applicable There is no universal score table for Qibla direction calculation.
Next exam timetable Not applicable Use official school or exam-board sources for course-specific exam dates.
Course relevance Useful for applied math Supports trigonometry, bearings, coordinates, radians, degrees, haversine distance, and spherical geometry.

Qibla Direction Finder FAQ

What is the Qibla direction?

The Qibla direction is the direction toward the Kaaba in Makkah. It is commonly expressed as a bearing measured clockwise from north.

How is Qibla direction calculated?

This calculator uses the initial great-circle bearing from your latitude and longitude to the Kaaba’s latitude and longitude. The formula uses spherical trigonometry and returns an angle from true north.

What does a Qibla bearing of 258° mean?

It means the Qibla is \(258^\circ\) clockwise from true north. Since west is \(270^\circ\), this direction is slightly south of west.

Should I use true north or magnetic north?

Use true north for GPS maps and geographic calculations. If you are using a physical magnetic compass, apply local magnetic declination to convert the true bearing into a magnetic compass bearing.

Why does the Qibla line sometimes look different on a flat map?

Flat maps distort Earth’s curved surface. The great-circle path is the shortest path on a globe, but it may look curved or counterintuitive on a flat map projection.

Why is my phone compass not accurate?

Phone compasses can be affected by magnets, metal, cases, vehicles, buildings, electronics, and poor calibration. Use GPS/map direction or compare multiple methods if the reading jumps.

Can I use this for mosque construction or permanent prayer-room alignment?

This tool is useful for calculation and planning, but permanent alignment should be verified with multiple methods and local expertise.

Advertisement

Turn across north using the shorter rotation

Suppose your current true bearing is 350 degrees and the desired bearing is 12 degrees. A clockwise turn of ten degrees reaches north. Another twelve degrees reaches the destination bearing, so the short rotation is 22 degrees. Simple subtraction gives a large negative number because the numerical scale starts over at north. The initial great-circle bearing refers to the starting location.

Drawing Angles in Standard Position

Properly defining an angle first requires that we define a ray. A ray consists of one point on a line and all points extending in one direction from that point. The first point is called the endpoint of the ray. We can refer to a specific ray by stating its endpoint and any other point on it. The ray in diagram can be named as ray EF, or in symbol form EF→.
Illustration of Ray EF, with point F and endpoint E.
An angle is the union of two rays having a common endpoint. The endpoint is called the vertex of the angle, and the two rays are the sides of the angle. The angle in diagram is formed from ED → and EF → . Angles can be named using a point on each ray and the vertex, such as angle DEF, or in symbol form ∠DEF.
Illustration of Angle DEF, with vertex E and points D and F.
Greek letters are often used as variables for the measure of an angle. table is a list of Greek letters commonly used to represent angles, and a sample angle is shown in diagram.
θ φorϕ α β γ
theta phi alpha beta gamma
Illustration of angle theta.
Angle theta, shown as ∠θ
Angle creation is a dynamic process. We start with two rays lying on top of one another. We leave one fixed in place, and rotate the other. The fixed ray is the initial side, and the rotated ray is the terminal side. In order to identify the different sides, we indicate the rotation with a small arc and arrow close to the vertex as in diagram.
Illustration of an angle with labels for initial side, terminal side, and vertex.
As we discussed at the beginning of the section, there are many applications for angles, but in order to use them correctly, we must be able to measure them. The measure of an angle is the amount of rotation from the initial side to the terminal side. Probably the most familiar unit of angle measurement is the degree. One degree is 1 360 of a circular rotation, so a complete circular rotation contains 360 degrees. An angle measured in degrees should always include the unit “degrees” after the number, or include the degree symbol °. For example, 90 degrees = 90°.
To formalize our work, we will begin by drawing angles on an x-y coordinate plane. Angles can occur in any position on the coordinate plane, but for the purpose of comparison, the convention is to illustrate them in the same position whenever possible. An angle is in standard position if its vertex is located at the origin, and its initial side extends along the positive x-axis. See diagram.
Graph of an angle in standard position with labels for the initial side and terminal side.
If the angle is measured in a counterclockwise direction from the initial side to the terminal side, the angle is said to be a positive angle. If the angle is measured in a clockwise direction, the angle is said to be a negative angle.
Drawing an angle in standard position always starts the same way—draw the initial side along the positive x-axis. To place the terminal side of the angle, we must calculate the fraction of a full rotation the angle represents. We do that by dividing the angle measure in degrees by 360°. For example, to draw a 90° angle, we calculate that 90° 360° = 1 4 . So, the terminal side will be one-fourth of the way around the circle, moving counterclockwise from the positive x-axis. To draw a 360° angle, we calculate that 360° 360° =1. So the terminal side will be 1 complete rotation around the circle, moving counterclockwise from the positive x-axis. In this case, the initial side and the terminal side overlap. See diagram.
Side by side graphs. Graph on the left is a 90 degree angle and graph on the right is a 360 degree angle. Terminal side and initial side are labeled for both graphs.
Since we define an angle in standard position by its initial side, we have a special type of angle whose terminal side lies on an axis, a quadrantal angle. This type of angle can have a measure of 0°, 90°, 180°, 270° or 360°. See diagram.
Four side by side graphs. First graph shows angle of 0 degrees. Second graph shows an angle of 90 degrees. Third graph shows an angle of 180 degrees. Fourth graph shows an angle of 270 degrees.
Quadrantal angles are angles in standard position whose terminal side lies along an axis. Examples are shown.

Drawing an Angle in Standard Position Measured in Degrees

  1. ⓐ Sketch an angle of 30° in standard position.
  2. ⓑ Sketch an angle of −135° in standard position.
Solution
  1. ⓐ Divide the angle measure by 360°.
    30° 360° = 1 12
    To rewrite the fraction in a more familiar fraction, we can recognize that
    1 12 = 1 3 ( 1 4 )
    One-twelfth equals one-third of a quarter, so by dividing a quarter rotation into thirds, we can sketch a line at 30° as in diagram.
    Graph of a 30 degree angle.
  2. ⓑ Divide the angle measure by 360°.
    −135° 360° =− 3 8
    In this case, we can recognize that
    − 3 8 =− 3 2 ( 1 4 )
    Negative three-eighths is one and one-half times a quarter, so we place a line by moving clockwise one full quarter and one-half of another quarter, as in diagram.
    Graph of a negative 135 degree angle.

Finding Coterminal Angles

Converting between degrees and radians can make working with angles easier in some applications. For other applications, we may need another type of conversion. Negative angles and angles greater than a full revolution are more awkward to work with than those in the range of 0° to 360°, or 0 to 2π. It would be convenient to replace those out-of-range angles with a corresponding angle within the range of a single revolution.
It is possible for more than one angle to have the same terminal side. Look at diagram. The angle of 140° is a positive angle, measured counterclockwise. The angle of –220° is a negative angle, measured clockwise. But both angles have the same terminal side. If two angles in standard position have the same terminal side, they are coterminal angles. Every angle greater than 360° or less than 0° is coterminal with an angle between 0° and 360°, and it is often more convenient to find the coterminal angle within the range of 0° to 360° than to work with an angle that is outside that range.
A graph showing the equivalence between a 140 degree angle and a negative 220 degree angle.
An angle of 140° and an angle of –220° are coterminal angles.
Any angle has infinitely many coterminal angles because each time we add 360° to that angle—or subtract 360° from it—the resulting value has a terminal side in the same location. For example, 100° and 460° are coterminal for this reason, as is −260°. Recognizing that any angle has infinitely many coterminal angles explains the repetitive shape in the graphs of trigonometric functions.
An angle’s reference angle is the measure of the smallest, positive, acute angle t′ formed by the terminal side of the angle t and the horizontal axis. Thus positive reference angles have terminal sides that lie in the first quadrant and can be used as models for angles in other quadrants. See diagram for examples of reference angles for angles in different quadrants.
Four side by side graphs. First graph shows an angle of t in quadrant 1 in it's normal position. Second graph shows an angle of t in quadrant 2 due to a rotation of pi minus t. Third graph shows an angle of t in quadrant 3 due to a rotation of t minus pi. Fourth graph shows an angle of t in quadrant 4 due to a rotation of two pi minus t.

Finding an Angle Coterminal with an Angle of Measure Greater Than 360°

Find the least positive angle θ that is coterminal with an angle measuring 800°, where 0°≤θ<360°.
Solution
An angle with measure 800° is coterminal with an angle with measure 800 − 360 = 440°, but 440° is still greater than 360°, so we subtract 360° again to find another coterminal angle: 440 − 360 = 80°.
The angle θ=80° is coterminal with 800°. To put it another way, 800° equals 80° plus two full rotations, as shown in diagram.
A graph showing the equivalence between an 80 degree angle and an 800 degree angle.

Finding an Angle Coterminal with an Angle Measuring Less Than 0°

Show the angle with measure −45° on a circle and find a positive coterminal angle α such that 0° ≤ α < 360°.
Solution
Since 45° is half of 90°, we can start at the positive horizontal axis and measure clockwise half of a 90° angle.
Because we can find coterminal angles by adding or subtracting a full rotation of 360°, we can find a positive coterminal angle here by adding 360°:
−45°+360°=315°
We can then show the angle on a circle, as in diagram.
A graph showing the equivalence of a 315 degree angle and a negative 45 degree angle.

Finding Coterminal Angles Measured in Radians

We can find coterminal angles measured in radians in much the same way as we have found them using degrees. In both cases, we find coterminal angles by adding or subtracting one or more full rotations.

Finding Coterminal Angles Using Radians

Find an angle β that is coterminal with 19π 4 , where 0≤β<2π.
Solution
When working in degrees, we found coterminal angles by adding or subtracting 360 degrees, a full rotation. Likewise, in radians, we can find coterminal angles by adding or subtracting full rotations of 2π radians:
19π 4 −2π= 19π 4 − 8π 4 = 11π 4
The angle 11π 4 is coterminal, but not less than 2π, so we subtract another rotation:
11π 4 −2π= 11π 4 − 8π 4 = 3π 4
The angle 3π 4 is coterminal with 19π 4 , as shown in diagram.
A graph showing a circle and the equivalence between angles of 3pi/4 radians and 19pi/4 radians.