Islamic Articles & Guides
Worship

How to Find the Qibla Direction: Compass, Sun and the Rulings

Last updated:

The mihrab of the Jameh Mosque in Kerman, the niche that marks the qibla
Mihrab, Jameh Mosque of Kerman · Bernard Gagnon · CC BY-SA 4.0

Every prayer begins with a direction. Before the words, before the standing, a Muslim turns toward the Kaaba in Makkah — and for most of the world's Muslims that means working out which way that is from wherever they happen to be. This article covers how to find the qibla direction: what the Qur'an and Sunna require, the four practical methods, why a phone compass so often disagrees with the mosque down the road, and what the scholars say when you get it wrong.

What the qibla is, and what the sources require

The qibla is the direction of the Kaaba, the House built by Ibrahim and Ismail in Makkah. Facing it is a condition of the prayer's validity, established by an explicit command:

"So turn your face toward al-Masjid al-Haram. And wherever you are, turn your faces toward it." (al-Baqara 2:144)

The verse was revealed after a period in which the Muslims prayed toward Jerusalem. The change is itself instructive: the direction is not intrinsically sacred, it is obeyed because it was commanded, and the same passage repeats the instruction twice more (2:149-150) — a repetition the commentators read as emphasis on its being binding wherever a Muslim happens to be.

Two other texts set the limits of that obligation.

The first is the mercy that governs the whole question:

"To Allah belong the east and the west. So wherever you turn, there is the Face of Allah." (al-Baqara 2:115)

The second is the hadith reported from Abu Hurayra, in which the Prophet ﷺ said:

مَا بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ قِبْلَةٌ

"What is between the east and the west is qibla."

Reported by at-Tirmidhi 342, who graded it hasan sahih, and Ibn Maja 1011. The scholars explain that this applies to someone far from Makkah, for whom the Kaaba occupies a wide arc rather than a needle-point: precision to the degree is not required of a person in Indonesia or Morocco, only that they face the direction as best they can determine.

Together these establish the working rule: face the Kaaba to the best of your ability, and your prayer is valid. The methods below are about doing that well, not about a burden of exactness the texts never imposed.


Where the qibla actually points

This is where most people's intuition fails, and it is worth understanding before touching any tool.

The qibla is the shortest path across the surface of the earth — what navigators call a great circle. The earth is a sphere, and the shortest route between two points on a sphere is not the straight line you would draw on a flat map.

The consequence is startling the first time you meet it. From New York, the qibla is roughly north-east, not the south-east that a flat map suggests. From London it is a little south of east-south-east. From Jakarta it is west-north-west. From Cape Town it is nearly due north.

Flat maps distort direction, badly, the further you get from the equator. The great-circle path from North America to Makkah passes near Greenland. That is not a quirk of the calculation; it is the actual shortest way, and it is what every qibla tool computes.

The qibla finder does this calculation from your device's location and shows the bearing directly.


Method 1: a compass or qibla app

The fastest method, and the one most people use. The tool computes the great-circle bearing from your coordinates and shows you where to turn.

It is also the method that most often goes wrong, for reasons that have nothing to do with the calculation.

Magnetic north is not true north

A magnetic compass — including the magnetometer in a phone — points at the magnetic north pole, which is not the geographic one. The angle between them is called magnetic declination, and it varies by location from almost nothing to more than twenty degrees. It also drifts over years as the magnetic pole moves.

Qibla bearings are calculated from true north. So a raw compass reading has to be corrected by the local declination before it means anything. Good qibla apps do this automatically; a plain compass and a printed bearing do not.

Metal and calibration

Phone magnetometers are cheap and easily thrown off. The common culprits:

  • metal desks, bed frames, radiators, filing cabinets
  • laptops, speakers, and anything with a motor
  • car bodies — a compass reading inside a car is close to worthless
  • phone cases with magnetic clasps, and magnetic car mounts
  • reinforced concrete floors and walls

The fix is to move away from metal and trace a figure of eight in the air with the phone, which is how the operating system recalibrates the sensor. If the reading swings around while you stand still, it has not settled and should not be trusted.

When the app and the mosque disagree

Trust the mosque. Its direction was surveyed once, with instruments better than a phone's, and a building does not drift. A discrepancy of a few degrees is inside the tolerance the "between east and west" hadith allows anyway; a large discrepancy means your phone is wrong.


Method 2: the sun directly over the Kaaba

Twice a year, the sun passes exactly over the Kaaba — an event called istiwa — and for a few minutes the qibla can be found anywhere the sun is visible, with no instrument at all.

The dates are approximately:

  • 27–28 May, at around 12:18 Makkah time
  • 15–16 July, at around 12:27 Makkah time

At that moment, stand any vertical object in the sun — a pole, a pencil, the edge of a wall — and its shadow points directly away from Makkah. Turn to face along the shadow toward the object, and you are facing the qibla. It works anywhere on the daylit half of the earth, and it is exact, because you are using the Kaaba itself as the reference rather than a model of it.

Twice a year the same thing happens in reverse — around 28 November and 16 January, when the sun is directly opposite the Kaaba — and then the shadow points toward Makkah instead.

Mosques and Islamic centres use these dates to check their mihrabs. It is worth marking a line on the floor at home once, on one of those days, and never needing a compass again.


Method 3: the sun and stars generally

Outside those dates the sun still helps, roughly. The sun rises in the east and sets in the west — but not exactly, except at the equinoxes, and the error is large at high latitudes. In the northern hemisphere the sun is due south at local solar noon; in the southern hemisphere, due north. Local solar noon is not clock noon: it shifts with your longitude within the time zone and with daylight saving.

At night, in the northern hemisphere, Polaris marks true north within about a degree — and because it marks true north, not magnetic, it needs no declination correction. In the southern hemisphere the Southern Cross serves the same role less precisely.

These give you a frame of reference. Combined with a known bearing for your city, they are enough to face the qibla without any device.


Method 4: a local mosque

The simplest method of all, and the most reliable. Find the direction of the nearest mosque's mihrab and copy it. Mosques are surveyed when they are built, and a mihrab that has stood for decades has usually been checked more than once.

If there is no mosque, a prayer room in an airport, hospital or shopping centre serves the same purpose, though these are worth a sanity check against an app since they are sometimes fitted by contractors rather than surveyed.


Praying in a car, plane or train

The obligation to face the qibla applies to obligatory prayers, and travel does not remove it — but it does soften it.

For obligatory prayers, the scholars hold that a traveller should face the qibla and pray properly where possible: on a plane, this may mean praying in an aisle or a free space; on a train or coach, facing the direction as the vehicle allows and turning as it turns if that is practical. Where it is genuinely not possible — a packed cabin, a moving car with no safe stop — the majority position is to pray facing whatever direction is possible rather than miss the prayer, on the strength of the general principle that Allah does not burden a soul beyond its capacity (al-Baqara 2:286).

For voluntary prayers, the concession is explicit and much broader. The Prophet ﷺ prayed voluntary prayers on his mount facing whichever direction it was travelling (Sahih al-Bukhari 1096, Sahih Muslim 700).

The practical guidance for a flight: check the qibla before boarding using your departure and arrival cities, note the seat-back map's heading during the flight, and if the direction is impossible to hold, pray as you can. Many airlines' in-flight maps display the qibla directly.

For questions specific to your situation, ask a qualified scholar; the rulings on travel prayer have detail this summary does not cover.


What if I prayed in the wrong direction?

This is the question people are most anxious about, and the answer is more merciful than expected.

If you made a sincere effort to determine the direction and later found you were wrong, the prayer is valid and does not need to be repeated. The scholars derive this from the fact that the obligation attaches to ijtihad — the effort to determine — not to the objective fact, for someone who cannot verify it. This is the position of the majority.

If you did not try at all, and simply guessed or faced any direction without attempting to find out, most scholars hold the prayer should be repeated, because the condition attaches to the effort and no effort was made.

If you realise mid-prayer that you are facing the wrong way, you turn to the correct direction and continue; you do not restart. This is established by the hadith of the people of Quba, who were praying when news reached them that the qibla had been changed to the Kaaba, and they turned mid-prayer (Sahih al-Bukhari 403, Sahih Muslim 526).

If the direction is simply undeterminable — heavy overcast, no device, no mosque, no one to ask — you face the direction you judge most likely and pray. Al-Baqara 2:115 is precisely about this case.


Frequently Asked Questions

How do I find the qibla without a compass or internet?

Use the sun. On 27–28 May and 15–16 July the sun passes directly over the Kaaba and every shadow points away from Makkah. Outside those dates, a nearby mosque is the most reliable reference; failing that, establish true north from the sun at local solar noon or from Polaris at night, and turn to your city's known qibla bearing from there.

Why does my phone compass show a different qibla than the mosque?

Almost always because the phone's magnetometer is disturbed or uncalibrated. Metal furniture, car bodies, speakers and magnetic phone cases all pull it off. Move away from metal, trace a figure of eight with the phone to recalibrate, and try again. If it still disagrees substantially, follow the mosque — its direction was surveyed with better instruments than a phone carries.

Is the qibla the shortest path or the direction on a map?

The shortest path across the globe — the great circle. This is why the qibla from North America is north-east rather than the south-east a flat map suggests. Flat maps distort direction increasingly with distance from the equator; the bearing is correct and the map is what misleads.

How exact does the qibla have to be?

For someone far from Makkah, not exact to the degree. The Prophet ﷺ said "what is between the east and the west is qibla" (at-Tirmidhi 342, hasan sahih), which the scholars apply to those at a distance, for whom the Kaaba subtends a wide arc. Within Makkah itself and its surroundings, precision is expected because it is attainable.

Do I need to repeat a prayer I prayed in the wrong direction?

If you made a genuine effort to determine the direction and it later turned out wrong, the majority of scholars hold the prayer is valid and needs no repetition. If you made no effort at all, it should be repeated. If you realise during the prayer, turn and continue without restarting, as the people of Quba did.

What is magnetic declination and does it affect the qibla?

It is the angle between magnetic north, where a compass points, and true north, from which qibla bearings are calculated. It varies by location from near zero to over twenty degrees and shifts slowly over years. A raw compass reading must be corrected for it; qibla apps normally apply the correction automatically, which is one reason an app and a bare compass can disagree.

How do I face the qibla on a plane?

For voluntary prayers there is a clear concession — the Prophet ﷺ prayed them on his mount in whatever direction it faced (al-Bukhari 1096). For obligatory prayers, face the qibla where you can; many in-flight maps show it directly. Where it is genuinely not possible, the majority position is to pray in the direction available rather than miss the prayer. Ask a qualified scholar about your particular circumstances.


Related Content


Sources

Note: this article presents the scholars' positions as explanation, not as a fatwa. For a personal question, consult a qualified scholar.

On this site

More Articles