Report

Help us improve this tool

Qibla Direction Finder

Enter latitude and longitude to get the compass bearing and distance to the Kaaba using a great-circle calculation.

O M T

How the bearing is calculated

The Qibla is the initial great-circle direction from your position to the Kaaba in Mecca. This tool uses the Kaaba at 21.422487° N, 39.826206° E. The bearing is degrees clockwise from true north, which is the same angle a magnetic compass shows only after you correct for local magnetic declination.

$$\theta = \operatorname{atan2}\left(\sin\Delta\lambda\cos\phi_2,\; \cos\phi_1\sin\phi_2 - \sin\phi_1\cos\phi_2\cos\Delta\lambda\right)$$

Distance uses the haversine formula and an Earth radius of 6371.0088 km. A result within 1 km of the Kaaba is reported as being at the Kaaba.

Example from Portland

The default coordinates are 45.5152° N, 122.6784° W. The bearing is 17.47°, which is north-northeast, and the distance is about 12,364 km (about 7,683 miles). Change the latitude and longitude, or use the device location button if the browser can share it. The coordinates stay in the page URL so you can bookmark a place.

Related coordinate tools

For a bearing between any two points, use the Azimuth Calculator. For distance only, use Latitude Longitude Distance or the Flight Distance Calculator.

Frequently Asked Questions

Is this the same as a magnetic compass heading?

No. The result is true north. A pocket compass points to magnetic north. Add or subtract the local declination before you follow a magnetic needle.

Why does the direction change as I travel?

A great-circle route does not keep a constant compass heading. The value here is the initial bearing from the coordinates you entered.

Which sign should longitude use?

East of Greenwich is positive and west is negative. Portland is about -122.68. Mecca is about 39.83.

Does the location button store my position on a server?

No. The browser asks for permission and the coordinates are used only in this page to update the bearing.

What if I enter the Kaaba coordinates?

The distance falls under 1 km and the result says you are at the Kaaba. A bearing from a point to itself is not a travel direction.