Detecting Location
The Qibla finder detects your current location via GPS and calculates the direction of the Holy Kaaba in degrees. The Islam Agenda Online Qibla Finder uses your device's orientation sensors (gyroscope and magnetometer) to provide a real-time, live compass experience.
The Qibla direction is determined by calculating the angle between your geographic coordinates and the coordinates of the Kaaba in Mecca (21.4225°N, 39.8262°E) using the Great-Circle formula. This calculation takes the spherical shape of the Earth into account and gives the correct Qibla angle from any point on Earth.
For the most precise results, hold your phone flat, keep away from metal objects and magnets. On first use, move your phone in a figure-8 pattern in the air to calibrate the sensor. Granting location permission allows the angle to be calculated for your personal coordinates; otherwise, Istanbul coordinates are used as a fallback.
The Qibla finder works on all iPhones and Android smartphones that have a magnetometer sensor. On desktop computers, the compass needle remains static since there is no orientation sensor, but the Qibla angle and distance are still displayed.