Skip to content
● Live
Live Islamic date, local prayer times, and rotating source-attributed wisdom.
Al-Qibla

Qibla Compass

To point the compass towards the Kaaba we need your position — nothing is stored.

Worship guide

Facing the Qibla: the ruling, the history and the practical method

Facing the Sacred Mosque in Mecca is a condition of the validity of the obligatory prayer in every school of Islamic law. The command is explicit: 'Turn your face toward the Sacred Mosque, and wherever you are, turn your faces toward it' (al-Baqara 2:144). This page explains how the direction is determined, what to do when you are uncertain, and how the schools treat honest error.

The change of the qibla

For roughly sixteen months after the migration to Medina the Muslims prayed toward Bayt al-Maqdis in Jerusalem. The verse of al-Baqara then directed the community to the Ka'ba. The event is recorded in Sahih al-Bukhari and Sahih Muslim and in the Shia collections including al-Kafi, and the site in Medina is still known as Masjid al-Qiblatayn, the mosque of the two qiblas. Tafsir al-Mizan and Tafsir al-Jalalayn both read the episode as a test of obedience rather than a claim that one direction is holier in itself.

How the direction is calculated

The qibla is the great-circle bearing from your position to the Ka'ba at 21.4225 degrees north, 39.8262 degrees east — the shortest path across the surface of the earth. This is why the correct direction from North America is north-east rather than the south-east a flat map suggests. This compass reads your device location and orientation and computes that bearing; a phone magnetometer is affected by metal, cars and electronics, so calibrate the device and step away from interference before relying on it.

When you cannot determine the direction

All five schools accept that a person who genuinely cannot establish the direction should exert reasonable effort (ijtihad) — using the sun, a mosque, a fixed landmark or a compass — and then pray toward the direction they most strongly believe correct. The prayer is valid. If the error becomes clear after the prayer, the Hanafi, Maliki and Ja'fari positions do not require repetition when the effort was sincere and the deviation was not a complete reversal; the Shafi'i school is stricter and asks for repetition when clear evidence later contradicts the choice.

Voluntary prayer while travelling

There is broad agreement that the voluntary prayer may be performed while riding or travelling in the direction of travel, based on the practice of the Prophet reported in the Sahih collections. This concession does not extend to the five obligatory prayers, which require facing the qibla unless it is genuinely impossible, such as on a moving vehicle with no opportunity to stop.

Precision is not perfection

Jurists distinguish between facing the Ka'ba exactly (ayn al-Ka'ba), required of those who can see it, and facing its general direction (jihat al-Ka'ba), which suffices for everyone else. A deviation of a few degrees does not invalidate the prayer of a distant worshipper. Excessive anxiety about degrees is discouraged in all schools.

Frequently asked questions

Why does my compass differ from the mosque near me?
Most established mosques were aligned with surveyed data. If your reading differs by a large margin, trust the mosque and recalibrate your device; a phone compass drifts easily near metal and electronics.
What if I pray in the wrong direction by mistake?
A prayer performed after sincere effort is valid in the view of the majority. Learn the correct direction for the next prayer and do not repeat what was done in good faith.
Does the compass work indoors?
It works, but steel structures and wiring distort the magnetic reading. Take the bearing near a window or outdoors and mark the direction inside the room.

Written and reviewed by the editorial team of Imam Mahdi Civilizition. Where the schools of Islamic law differ, the positions of the Hanafi, Maliki, Shafi'i, Hanbali and Ja'fari schools are presented side by side. For a binding ruling in your own circumstances, consult a qualified scholar of the school you follow.