The qibla () is the direction towards the
Kaaba
The Kaaba (), also spelled Kaba, Kabah or Kabah, sometimes referred to as al-Kaba al-Musharrafa (), is a stone building at the center of Islam's most important mosque and Holiest sites in Islam, holiest site, the Masjid al-Haram in Mecca, Sa ...
in the
Sacred Mosque in
Mecca
Mecca, officially Makkah al-Mukarramah, is the capital of Mecca Province in the Hejaz region of western Saudi Arabia; it is the Holiest sites in Islam, holiest city in Islam. It is inland from Jeddah on the Red Sea, in a narrow valley above ...
, which is used by
Muslims
Muslims () are people who adhere to Islam, a Monotheism, monotheistic religion belonging to the Abrahamic religions, Abrahamic tradition. They consider the Quran, the foundational religious text of Islam, to be the verbatim word of the God ...
in various religious contexts, particularly the
direction of prayer for the
salah
''Salah'' (, also spelled ''salat'') is the practice of formal worship in Islam, consisting of a series of ritual prayers performed at prescribed times daily. These prayers, which consist of units known as ''rak'ah'', include a specific s ...
. In Islam, the Kaaba is believed to be a sacred site built by prophets
Abraham
Abraham (originally Abram) is the common Hebrews, Hebrew Patriarchs (Bible), patriarch of the Abrahamic religions, including Judaism, Christianity, and Islam. In Judaism, he is the founding father who began the Covenant (biblical), covenanta ...
and
Ishmael
In the Bible, biblical Book of Genesis, Ishmael (; ; ; ) is the first son of Abraham. His mother was Hagar, the handmaiden of Abraham's wife Sarah. He died at the age of 137. Traditionally, he is seen as the ancestor of the Arabs.
Within Isla ...
, and that its use as the qibla was ordained by God in several verses of the
Quran
The Quran, also Romanization, romanized Qur'an or Koran, is the central religious text of Islam, believed by Muslims to be a Waḥy, revelation directly from God in Islam, God (''Allah, Allāh''). It is organized in 114 chapters (, ) which ...
revealed to
Muhammad
Muhammad (8 June 632 CE) was an Arab religious and political leader and the founder of Islam. Muhammad in Islam, According to Islam, he was a prophet who was divinely inspired to preach and confirm the tawhid, monotheistic teachings of A ...
in the second
Hijri year
The Hijri year () or era () is the era used in the Islamic lunar calendar. It begins its count from the Islamic New Year in which Muhammad and his followers migrated from Mecca to Yathrib (now Medina) in 622 CE. This event, known as the Hij ...
. Prior to this revelation, Muhammad and his followers in
Medina
Medina, officially al-Madinah al-Munawwarah (, ), also known as Taybah () and known in pre-Islamic times as Yathrib (), is the capital of Medina Province (Saudi Arabia), Medina Province in the Hejaz region of western Kingdom of Saudi Arabia, ...
faced
Jerusalem
Jerusalem is a city in the Southern Levant, on a plateau in the Judaean Mountains between the Mediterranean Sea, Mediterranean and the Dead Sea. It is one of the List of oldest continuously inhabited cities, oldest cities in the world, and ...
for prayers. Most
mosque
A mosque ( ), also called a masjid ( ), is a place of worship for Muslims. The term usually refers to a covered building, but can be any place where Salah, Islamic prayers are performed; such as an outdoor courtyard.
Originally, mosques were si ...
s contain a (a wall niche) that indicates the direction of the qibla.
The qibla is also the direction for entering the (sacred state for the
hajj
Hajj (; ; also spelled Hadj, Haj or Haji) is an annual Islamic pilgrimage to Mecca, Saudi Arabia, the holiest city for Muslims. Hajj is a mandatory religious duty for capable Muslims that must be carried out at least once in their lifetim ...
pilgrimage); the direction to which animals are turned during (Islamic slaughter); the recommended direction to make (supplications); the direction to avoid when relieving oneself or spitting; and the direction to which the deceased are aligned when
buried. The qibla may be observed facing the Kaaba accurately () or facing in the general direction (). Most Islamic scholars consider that is acceptable if the more precise cannot be ascertained.
The most common technical definition used by Muslim astronomers for a location is the direction on the
great circle
In mathematics, a great circle or orthodrome is the circular intersection of a sphere and a plane passing through the sphere's center point.
Discussion
Any arc of a great circle is a geodesic of the sphere, so that great circles in spher ...
—in the
Earth's Sphere—passing through the location and the Kaaba. This is the direction of the shortest possible path from a place to the Kaaba, and allows the exact calculation () of the qibla using a
spherical trigonometric formula that takes the coordinates of a location and of the Kaaba as inputs (
see formula below). The method is applied to develop
mobile app
A mobile application or app is a computer program or software application designed to run on a mobile device such as a smartphone, phone, tablet computer, tablet, or smartwatch, watch. Mobile applications often stand in contrast to desktop appli ...
lications and websites for Muslims, and to compile qibla tables used in instruments such as the
qibla compass. The qibla can also be determined at a location by
observing the shadow of a vertical rod on the twice-yearly occasions when the Sun is directly overhead in Mecca—on 27 and 28 May at 12:18
Saudi Arabia Standard Time (09:18 UTC), and on 15 and 16 July at 12:27 SAST (09:27 UTC).
Before the development of astronomy in the Islamic world, Muslims used traditional methods to determine the qibla. These methods included facing the direction that the
companions of Muhammad had used when in the same place; using the setting and rising points of celestial objects; using the direction of the wind; or using due south, which was Muhammad's qibla in Medina. Early
Islamic astronomy was built on its
Indian and
Greek counterparts, especially the works of
Ptolemy
Claudius Ptolemy (; , ; ; – 160s/170s AD) was a Greco-Roman mathematician, astronomer, astrologer, geographer, and music theorist who wrote about a dozen scientific treatises, three of which were important to later Byzantine science, Byzant ...
, and soon Muslim astronomers developed methods to calculate the approximate directions of the qibla, starting from the mid-9th century. In the late 9th and 10th centuries, Muslim astronomers developed methods to find the
exact direction of the qibla which are equivalent to the modern formula. Initially, this "qibla of the astronomers" was used alongside various traditionally determined qiblas, resulting in much diversity in medieval Muslim cities. In addition, the accurate geographic data necessary for the astronomical methods to yield an accurate result was not available before the 18th and 19th centuries, resulting in further diversity of the qibla. Historical mosques with differing qiblas still stand today throughout the
Islamic world
The terms Islamic world and Muslim world commonly refer to the Islamic community, which is also known as the Ummah. This consists of all those who adhere to the religious beliefs, politics, and laws of Islam or to societies in which Islam is ...
. The
spaceflight
Spaceflight (or space flight) is an application of astronautics to fly objects, usually spacecraft, into or through outer space, either with or without humans on board. Most spaceflight is uncrewed and conducted mainly with spacecraft such ...
of a devout Muslim,
Sheikh Muszaphar Shukor, to the
International Space Station
The International Space Station (ISS) is a large space station that was Assembly of the International Space Station, assembled and is maintained in low Earth orbit by a collaboration of five space agencies and their contractors: NASA (United ...
(ISS) in 2007 generated a discussion with regard to the qibla direction from
low Earth orbit
A low Earth orbit (LEO) is an geocentric orbit, orbit around Earth with a orbital period, period of 128 minutes or less (making at least 11.25 orbits per day) and an orbital eccentricity, eccentricity less than 0.25. Most of the artificial object ...
, prompting the
Islamic authority of his home country,
Malaysia
Malaysia is a country in Southeast Asia. Featuring the Tanjung Piai, southernmost point of continental Eurasia, it is a federation, federal constitutional monarchy consisting of States and federal territories of Malaysia, 13 states and thre ...
, to recommend determining the qibla "based on what is possible" for the astronaut.
Location
The qibla is the direction of the
Kaaba
The Kaaba (), also spelled Kaba, Kabah or Kabah, sometimes referred to as al-Kaba al-Musharrafa (), is a stone building at the center of Islam's most important mosque and Holiest sites in Islam, holiest site, the Masjid al-Haram in Mecca, Sa ...
, a cube-like building at the centre of the
Sacred Mosque (') in
Mecca
Mecca, officially Makkah al-Mukarramah, is the capital of Mecca Province in the Hejaz region of western Saudi Arabia; it is the Holiest sites in Islam, holiest city in Islam. It is inland from Jeddah on the Red Sea, in a narrow valley above ...
, in the
Hijaz region of Saudi Arabia. Other than its role as qibla, it is also the
holiest site for Muslims, also known as the House of God () and where the (the
circumambulation
Circumambulation (from Latin ''circum'' around and ''ambulātus ''to walk) is the act of moving around a sacred object or idol.
Circumambulation of temples or deity images is an integral part of Hindu and Buddhist devotional practice (known in ...
ritual) is performed during the
Hajj
Hajj (; ; also spelled Hadj, Haj or Haji) is an annual Islamic pilgrimage to Mecca, Saudi Arabia, the holiest city for Muslims. Hajj is a mandatory religious duty for capable Muslims that must be carried out at least once in their lifetim ...
and
umrah
The Umrah () is an Islamic pilgrimage to Mecca, the holiest city for Muslims, located in the Hejazi region of Saudi Arabia. It can be undertaken at any time of the year, in contrast to the '' Ḥajj'' (; "pilgrimage"), which has specific d ...
pilgrimages. The Kaaba has an approximately rectangular ground plan with its four corners pointing close to the four
cardinal direction
The four cardinal directions or cardinal points are the four main compass directions: north (N), south (S), east (E), and west (W). The corresponding azimuths ( clockwise horizontal angle from north) are 0°, 90°, 180°, and 270°.
The ...
s. According to the
Quran
The Quran, also Romanization, romanized Qur'an or Koran, is the central religious text of Islam, believed by Muslims to be a Waḥy, revelation directly from God in Islam, God (''Allah, Allāh''). It is organized in 114 chapters (, ) which ...
, it was built by
Abraham
Abraham (originally Abram) is the common Hebrews, Hebrew Patriarchs (Bible), patriarch of the Abrahamic religions, including Judaism, Christianity, and Islam. In Judaism, he is the founding father who began the Covenant (biblical), covenanta ...
and
Ishmael
In the Bible, biblical Book of Genesis, Ishmael (; ; ; ) is the first son of Abraham. His mother was Hagar, the handmaiden of Abraham's wife Sarah. He died at the age of 137. Traditionally, he is seen as the ancestor of the Arabs.
Within Isla ...
, both of whom are prophets in Islam. Few historical records remain detailing the history of the Kaaba before the rise of Islam, but in the generations prior to Muhammad, the Kaaba had been used as a shrine of the
pre-Islamic Arabic religion.
The qibla status of the Kaaba (or the Sacred Mosque in which it is located) is based on the verses 144, 149, and 150 of the
al-Baqarah chapter of the Quran, each of which contains a command to "turn your face toward the Sacred Mosque" (). According to Islamic traditions, these verses were revealed in the month of
Rajab or
Sha'ban in the second
Hijri year
The Hijri year () or era () is the era used in the Islamic lunar calendar. It begins its count from the Islamic New Year in which Muhammad and his followers migrated from Mecca to Yathrib (now Medina) in 622 CE. This event, known as the Hij ...
(623 CE), or about 15 or 16 months after Muhammad's
migration to Medina. Prior to these revelations, Muhammad and the Muslims in
Medina
Medina, officially al-Madinah al-Munawwarah (, ), also known as Taybah () and known in pre-Islamic times as Yathrib (), is the capital of Medina Province (Saudi Arabia), Medina Province in the Hejaz region of western Kingdom of Saudi Arabia, ...
had prayed towards
Jerusalem
Jerusalem is a city in the Southern Levant, on a plateau in the Judaean Mountains between the Mediterranean Sea, Mediterranean and the Dead Sea. It is one of the List of oldest continuously inhabited cities, oldest cities in the world, and ...
as the qibla, the same direction as the prayer direction—the —used by the
Jews of Medina. Islamic tradition says that these verses were revealed during a prayer congregation; Muhammad and his followers immediately changed their direction from Jerusalem to Mecca in the middle of the prayer ritual. The location of this event became the
Masjid al-Qiblatayn ("The Mosque of the Two Qiblas").
There are different reports of the qibla direction when Muhammad was in Mecca (before his migration to Medina). According to a report cited by historian
al-Tabari
Abū Jaʿfar Muḥammad ibn Jarīr ibn Yazīd al-Ṭabarī (; 839–923 CE / 224–310 AH), commonly known as al-Ṭabarī (), was a Sunni Muslim scholar, polymath, historian, exegete, jurist, and theologian from Amol, Tabaristan, present- ...
and exegete (textual interpreter)
al-Baydawi
Qadi Baydawi (also known as Naṣir ad-Din al-Bayḍawi, also spelled Baidawi, Bayzawi and Beyzavi; d. June 1319, Tabriz) was a jurist, theologian, and Quran commentator. He lived during the post-Seljuk Empire, Seljuk and early Mongol Empire, Mon ...
, Muhammad prayed towards the Kaaba. Another report, cited by
al-Baladhuri
ʾAḥmad ibn Yaḥyā ibn Jābir al-Balādhurī () was a 9th-century West Asian historian. One of the eminent Middle Eastern historians of his age, he spent most of his life in Baghdad and enjoyed great influence at the court of the caliph al ...
and also by al-Tabari, says that Muhammad prayed towards Jerusalem while in Mecca. Another report, mentioned in
Ibn Hisham's
biography of Muhammad, says that Muhammad prayed in such a way as to face the Kaaba and Jerusalem simultaneously. Today Muslims of all branches, including the
Sunni
Sunni Islam is the largest branch of Islam and the largest religious denomination in the world. It holds that Muhammad did not appoint any successor and that his closest companion Abu Bakr () rightfully succeeded him as the caliph of the Mu ...
and the
Shia, all pray towards the Kaaba. Historically, one major exception was the
Qarmatians, a now-defunct syncretic Shia sect which rejected the Kaaba as the qibla; in 930, they
sacked Mecca and for a time took the Kaaba's
Black Stone
The Black Stone () is a rock set into the eastern corner of the Kaaba, the ancient building in the center of the Masjid al-Haram, Grand Mosque in Mecca, Saudi Arabia. It is revered by Muslims as an Islamic relic which, according to Muslim tradi ...
to their centre of power in
al-Ahsa, with the intention of starting a new era in Islam.
Religious significance
Etymologically, the Arabic word () means "direction". In Islamic ritual and law, it refers to a special direction faced by Muslims during prayers and other religious contexts.
Islamic religious scholars agree that facing the qibla is a necessary condition for the validity of
salah
''Salah'' (, also spelled ''salat'') is the practice of formal worship in Islam, consisting of a series of ritual prayers performed at prescribed times daily. These prayers, which consist of units known as ''rak'ah'', include a specific s ...
—the Islamic ritual prayer—in normal conditions; exceptions include prayers during a state of fear or war, as well as non-obligatory prayers during travel. The
hadith
Hadith is the Arabic word for a 'report' or an 'account f an event and refers to the Islamic oral tradition of anecdotes containing the purported words, actions, and the silent approvals of the Islamic prophet Muhammad or his immediate circle ...
(Muhammad's tradition) also prescribes that Muslims face the qibla when entering the (sacred state for hajj), after the middle (stone-throwing ritual) during the pilgrimage.
Islamic etiquette () calls for Muslims to turn the head of an animal when it is
slaughtered, and the faces of the dead when they are buried, toward the qibla. The qibla is the preferred direction when making a
supplication and is to be avoided when defecating, urinating, and spitting.
Inside a mosque, the qibla is usually indicated by a , a
niche in its qibla-facing wall. In a congregational prayer, the
imam
Imam (; , '; : , ') is an Islamic leadership position. For Sunni Islam, Sunni Muslims, Imam is most commonly used as the title of a prayer leader of a mosque. In this context, imams may lead Salah, Islamic prayers, serve as community leaders, ...
stands in it or close to it, in front of the rest of the congregation. The became a part of the mosque during the
Umayyad period and its form was standardised during the
Abbasid period; before that, the qibla of a mosque was known from the orientation of one of its walls, called the qibla wall. The term ' itself is attested only once in the Quran, but it refers to a place of prayer of the
Israelites
Israelites were a Hebrew language, Hebrew-speaking ethnoreligious group, consisting of tribes that lived in Canaan during the Iron Age.
Modern scholarship describes the Israelites as emerging from indigenous Canaanites, Canaanite populations ...
rather than a part of a mosque. The
Amr ibn al-As Mosque in
Fustat, Egypt, one of the oldest mosques, is known to have been built originally without a ', though one has since been added.
' and '
("standing so as to face the Kaaba head-on") is a position facing the qibla so that an imaginary line extending from the person's line of sight would pass through the Kaaba. This manner of observing the qibla is easily done inside the Great Mosque of Mecca and its surroundings, but given that the Kaaba is less than wide, this is virtually impossible from distant locations. For example, from Medina, with a straight-line distance from the Kaaba, a one-
degree deviation from the precise imaginary line—an error hardly noticeable when setting one's prayer mat or assuming one's posture—results in a shift from the site of the Kaaba. This effect is amplified when further than Mecca: from
Jakarta
Jakarta (; , Betawi language, Betawi: ''Jakartè''), officially the Special Capital Region of Jakarta (; ''DKI Jakarta'') and formerly known as Batavia, Dutch East Indies, Batavia until 1949, is the capital and largest city of Indonesia and ...
, Indonesia—some away, a one-degree deviation causes more than a shift, and even an
arc second
A minute of arc, arcminute (abbreviated as arcmin), arc minute, or minute arc, denoted by the symbol , is a unit of angular measurement equal to of a degree. Since one degree is of a turn, or complete rotation, one arcminute is of a tu ...
's deviation——causes a more than shift from the location of the Kaaba. In comparison, the construction process of a mosque can easily introduce an error of up to five degrees from the calculated qibla, and the installation of prayer rugs inside the mosque as indicators for worshipers can add another deviation of five degrees from the mosque's orientation.
A minority of Islamic religious scholars—for example
Ibn Arabi ()—consider ' to be obligatory during the ritual prayer, while others consider it obligatory only when one is able. For locations further than Mecca, scholars such as
Abu Hanifa
Abu Hanifa (; September 699 CE – 767 CE) was a Muslim scholar, jurist, theologian, ascetic,Pakatchi, Ahmad and Umar, Suheyl, "Abū Ḥanīfa", in: ''Encyclopaedia Islamica'', Editors-in-Chief: Wilferd Madelung and, Farhad Daftary. and epony ...
() and
Al-Qurtubi () argue that it is permissible to assume , facing only the general direction of the Kaaba. Others argue that the ritual condition of facing the qibla is already fulfilled when the imaginary line to the Kaaba is within one's field of vision. For instance, there are legal opinions that accept the entire southeastern quadrant in
Al-Andalus
Al-Andalus () was the Muslim-ruled area of the Iberian Peninsula. The name refers to the different Muslim states that controlled these territories at various times between 711 and 1492. At its greatest geographical extent, it occupied most o ...
(Islamic
Iberian Peninsula
The Iberian Peninsula ( ), also known as Iberia, is a peninsula in south-western Europe. Mostly separated from the rest of the European landmass by the Pyrenees, it includes the territories of peninsular Spain and Continental Portugal, comprisin ...
), and the southwestern quadrant in Central Asia, to be valid qibla. Arguments for the validity of ' include the wording of the Quran, which commands Muslims only to "turn
ne'sface" toward the Great Mosque, and to avoid imposing requirements that would be impossible to fulfill if ' were to be obligatory in all places. The
Shafi'i school
The Shafi'i school or Shafi'i Madhhab () or Shafi'i is one of the four major schools of fiqh (Islamic jurisprudence), belonging to the Ahl al-Hadith tradition within Sunni Islam. It was founded by the Muslim scholar, jurist, and traditionis ...
of Islamic law, as codified in
Abu Ishaq al-Shirazi's 11th-century ', argues that one must follow the qibla indicated by the local mosque when one is not near Mecca or, when not near a mosque, to ask a trustworthy person. When this is not possible, one is to make one's own determination—to exercise —by the means at one's disposal.
Determination
Theoretical basis: the great circle

A
great circle
In mathematics, a great circle or orthodrome is the circular intersection of a sphere and a plane passing through the sphere's center point.
Discussion
Any arc of a great circle is a geodesic of the sphere, so that great circles in spher ...
, also called the orthodrome, is any circle on a sphere whose centre is identical to the centre of the sphere. For example, all lines of
longitude
Longitude (, ) is a geographic coordinate that specifies the east- west position of a point on the surface of the Earth, or another celestial body. It is an angular measurement, usually expressed in degrees and denoted by the Greek lett ...
are great circles of the Earth, while the
equator
The equator is the circle of latitude that divides Earth into the Northern Hemisphere, Northern and Southern Hemisphere, Southern Hemispheres of Earth, hemispheres. It is an imaginary line located at 0 degrees latitude, about in circumferen ...
is the only line of
latitude
In geography, latitude is a geographic coordinate system, geographic coordinate that specifies the north-south position of a point on the surface of the Earth or another celestial body. Latitude is given as an angle that ranges from −90° at t ...
that is also a great circle (other lines of latitude are centered north or south of the centre of the Earth). The great circle is the theoretical basis in most models that seek to mathematically determine the direction of the qibla from a locality. In such models, the qibla is defined as the direction of the great circle passing through the locality and the Kaaba. One of the properties of a great circle is that it indicates the shortest path connecting any pair of points along the circle—this is the basis of its use to determine the qibla. The great circle is similarly used to find the shortest flight path connecting the two locations—therefore the qibla calculated using the great circle method is generally close to the direction of the locality to Mecca. As the
ellipsoid
An ellipsoid is a surface that can be obtained from a sphere by deforming it by means of directional Scaling (geometry), scalings, or more generally, of an affine transformation.
An ellipsoid is a quadric surface; that is, a Surface (mathemat ...
is a more accurate
figure of the Earth
In geodesy, the figure of the Earth is the size and shape used to model planet Earth. The kind of figure depends on application, including the precision needed for the model. A spherical Earth is a well-known historical approximation that is ...
than a perfect sphere, modern researchers have looked into using ellipsoidal models to calculate the qibla, replacing the great circle by the
geodesics on an ellipsoid. This results in more complicated calculations, while the improvement in accuracy falls well within the typical precision of the setting out of a mosque or the placement of a mat. For example, calculations using the
GRS 80 ellipsoidal model yields the qibla of 18°47′06″ for a location in
San Francisco
San Francisco, officially the City and County of San Francisco, is a commercial, Financial District, San Francisco, financial, and Culture of San Francisco, cultural center of Northern California. With a population of 827,526 residents as of ...
, while the great circle method yields 18°51′05″.
Calculations with spherical trigonometry
The great circle model is applied to calculate the qibla using
spherical trigonometry
Spherical trigonometry is the branch of spherical geometry that deals with the metrical relationships between the edge (geometry), sides and angles of spherical triangles, traditionally expressed using trigonometric functions. On the sphere, ge ...
—a branch of
geometry
Geometry (; ) is a branch of mathematics concerned with properties of space such as the distance, shape, size, and relative position of figures. Geometry is, along with arithmetic, one of the oldest branches of mathematics. A mathematician w ...
that deals with the mathematical relations between the sides and angles of triangles formed by three great circles of a sphere (as opposed to the conventional
trigonometry
Trigonometry () is a branch of mathematics concerned with relationships between angles and side lengths of triangles. In particular, the trigonometric functions relate the angles of a right triangle with ratios of its side lengths. The fiel ...
which deals with those of a two-dimensional triangle).
If a location
, the Kaaba
, and the north pole
form a triangle on the sphere of the Earth, then the qibla is indicated by
, which is the direction of the great circle passing through both
and
. The qibla can also be expressed as an angle,
(or
), of the qibla with respect to the north, also called the ''inhiraf al-qibla''. This angle can be calculated as a mathematical function of the local latitude
, the latitude of the Kaaba
, and the longitude difference between the locality and the Kaaba
. This function is derived from the
cotangent rule which applies to any spherical triangle with angles
,
,
and sides
,
,
:
Applying this formula in the spherical triangle
(substituting
) and applying
trigonometric identities obtain:
This formula was derived by modern scholars, but equivalent methods have been known to Muslim astronomers since the 9th century (3rd century ), developed by various scholars, including
Habash al-Hasib (active in
Damascus
Damascus ( , ; ) is the capital and List of largest cities in the Levant region by population, largest city of Syria. It is the oldest capital in the world and, according to some, the fourth Holiest sites in Islam, holiest city in Islam. Kno ...
and
Baghdad
Baghdad ( or ; , ) is the capital and List of largest cities of Iraq, largest city of Iraq, located along the Tigris in the central part of the country. With a population exceeding 7 million, it ranks among the List of largest cities in the A ...
),
Al-Nayrizi (Baghdad, ),
Ibn Yunus (10th–11th century),
Ibn al-Haytham
Ḥasan Ibn al-Haytham (Latinization of names, Latinized as Alhazen; ; full name ; ) was a medieval Mathematics in medieval Islam, mathematician, Astronomy in the medieval Islamic world, astronomer, and Physics in the medieval Islamic world, p ...
(11th century), and
Al-Biruni (11th century). Today spherical trigonometry also underlies nearly all applications or websites which calculate the qibla.
When the qibla angle with respect to the north,
, is known,
true north
True north is the direction along Earth's surface towards the place where the imaginary rotational axis of the Earth intersects the surface of the Earth on its Northern Hemisphere, northern half, the True North Pole. True south is the direction ...
needs to be known to find the qibla in practice. Common practical methods to find it include the observation of the shadow at the
culmination
In observational astronomy, culmination is the passage of a celestial object (such as the Sun, the Moon, a planet, a star, constellation or a deep-sky object) across the observer's local meridian. These events are also known as meridian tran ...
of the sun—when the sun crosses exactly the
local meridian. At this point, any vertical object would cast a shadow oriented in the north–south direction. The result of this observation is very accurate, but it requires an accurate determination of the local time of culmination as well as making the correct observation at that exact moment. Another common method is using the compass, which is more practical because it can be done at any time; the disadvantage is that the north indicated by a magnetic compass differs from true north. This
magnetic declination can measure up to 20°, which can vary in different places on Earth and
changes over time.
Shadow observation

As observed from Earth, the Sun appears to "
shift" between the
Northern and
Southern Tropics seasonally; additionally, it
appears to move from east to west daily as a consequence of the Earth's rotation. The combination of these two apparent motions means that every day the Sun crosses the meridian once, usually not precisely overhead but to the north or to the south of the observer. In locations between the two tropics—latitudes lower than 23.5° north or south—at certain moments of the year (usually twice a year) the Sun passes almost directly overhead. This happens when the Sun crosses the meridian while being at the local latitude at the same time.
The city of Mecca is among the places where this occurs, due to its location at 21°25′ N. It occurs twice a year, firstly on 27/28 May at about 12:18
Saudi Arabia Standard Time (SAST) or 09:18 UTC, and secondly on 15/16 July at 12:27 SAST (09:27 UTC). As the sun reaches the
zenith
The zenith (, ) is the imaginary point on the celestial sphere directly "above" a particular location. "Above" means in the vertical direction (Vertical and horizontal, plumb line) opposite to the gravity direction at that location (nadir). The z ...
of the Kaaba, any vertical object on earth that receives sunlight cast a shadow that indicates the qibla (''see picture''). This method of finding the qibla is called ("observing the qibla"). Since night falls on the hemisphere opposite of the Kaaba, half the locations on Earth (including Australia as well as most of the Americas and the Pacific Ocean) cannot observe this directly. Instead, such places observe the opposite phenomenon when the Sun passes above the
antipodal point of the Kaaba (in other words, the Sun passes directly underneath the Kaaba), causing shadows in the opposite direction from those observed during '. This occurs twice a year, on 14 January 00:30 SAST (21:30 UTC the previous day) and 29 November 00:09 SAST (21:09 UTC the previous day). Observations made within five minutes of the ' moments or its antipodal counterparts, or at the same time of the day two days before or after each event, still show accurate directions with negligible difference.
On the world map

Spherical trigonometry provides the shortest path from any point on Earth to the Kaaba, even though the indicated direction might seem counterintuitive when imagined on a flat
world map
A world map is a map of most or all of the surface of Earth. World maps, because of their scale, must deal with the problem of projection. Maps rendered in two dimensions by necessity distort the display of the three-dimensional surface of t ...
. For example, the qibla from
Alaska
Alaska ( ) is a non-contiguous U.S. state on the northwest extremity of North America. Part of the Western United States region, it is one of the two non-contiguous U.S. states, alongside Hawaii. Alaska is also considered to be the north ...
obtained through spherical trigonometry is almost due north. This apparent counter-intuitiveness is caused by
projections used by world maps, which by necessity distort the surface of the Earth. A straight line shown by the world map in using the
Mercator projection is called the
rhumb line or the loxodrome, which is used to indicate the qibla by a minority of Muslims. It can result in a dramatic difference in some places; for example, in some parts of North America the flat map shows Mecca in the southeast while the great circle calculation shows it to the northeast. In Japan the map shows it to the southwest, while the great circle shows it to the northwest. The majority of Muslims, however, follow the great circle method.
A
retroazimuthal projection is any map projection which preserves the angular direction (the
azimuth
An azimuth (; from ) is the horizontal angle from a cardinal direction, most commonly north, in a local or observer-centric spherical coordinate system.
Mathematically, the relative position vector from an observer ( origin) to a point ...
) of the great circle path from any point of the map to a point selected as the center of the map. The initial purpose of its development was to help finding the qibla, by choosing the Kaaba as the center point. The earliest surviving works using this projection were two astrolabe-shaped brass instruments created in 18th-century Iran. They contain grids covering locations between Spain and China, label the locations of major cities along with their names, but do not show any coastline. The first of the two was discovered in 1989; its diameter is and it has a ruler with which one can read the direction of Mecca from the markings on the instrument's circumference, and the distance to Mecca from the markings on the ruler. Only the second one is signed by its creator, Muhammad Husayn. The first formal design of a retroazimuthal projection in the Western literature is the
Craig projection or the Mecca projection, created by the Scottish mathematician
James Ireland Craig, who worked at the Survey Department of Egypt, in 1910. His map is centered in Mecca and its range is limited to show the predominantly Muslim lands. Extending the map further than 90° in longitude from the center will result in crowding and overlaps.
Traditional methods
Historical records and surviving old mosques show that throughout history the qibla was often determined by simple methods based on tradition or "folk science" not based on mathematical astronomy. Some early Muslims used due south everywhere as the qibla, literally following Muhammad's instruction to face south while he was in Medina (Mecca is due south of Medina). Some mosques as far away as al-Andalus to the west and Central Asia to the east face south, even though Mecca is nowhere near that direction. In various places, there are also the "qiblas of the companions" (), those which were used there by the
Companions of the Prophet
The Companions of the Prophet () were the Muslim disciples and followers of the Islamic prophet Muhammad who saw or met him during his lifetime. The companions played a major role in Muslim battles, society, hadith narration, and governance ...
—the first generation of Muslims, who are considered role models in Islam. Such directions were used by some Muslims in the following centuries, side by side with other directions, even after Muslim astronomers used calculations to find more accurate directions to Mecca. Among the directions described as the qiblas of the companions are due south in Syria and Palestine, the direction of the winter sunrise in Egypt, and the direction of the winter sunset in Iraq. The direction of the winter sunrise and sunset are also traditionally favoured because they are parallel to the walls of the Kaaba.
Development of methods
Pre-astronomy
The determination of qibla has been an important problem for Muslim communities throughout history. Muslims are required to know the qibla to perform their daily prayers, and it is also needed to determine the orientation of mosques. When Muhammad lived among the Muslims in Medina (which, like Mecca, is also in the Hejaz region), he prayed due south, according to the known direction of Mecca. Within the few generations after Muhammad's death in 632, Muslims had reached places far away from Mecca, presenting the problem of determining the qibla in new locations. Mathematical methods based on astronomy would develop only at the end of the 8th century or the beginning of the 9th, and even then they were not initially popular. Therefore, early Muslims relied on non-astronomical methods.
There was a wide range of traditional methods in determining the qibla during the early Islamic period, resulting in different directions even from the same place. In addition to due south and the qiblas of the companions, the Arabs also knew a form of "folk" astronomy—called so by the historian of astronomy
David A. King to distinguish it from conventional astronomy, which is an exact science—originating from pre-Islamic traditions. It used natural phenomenon, including the observation of the Sun, the Moon, the stars, and wind, without any basis in mathematics. These methods yield specific directions in individual localities, often using the fixed setting and rising points of a specific star, the sunrise or sunset at the
equinoxes, or at the
summer
Summer or summertime is the hottest and brightest of the four temperate seasons, occurring after spring and before autumn. At or centred on the summer solstice, daylight hours are the longest and darkness hours are the shortest, with day ...
or the
winter solstice
The winter solstice, or hibernal solstice, occurs when either of Earth's geographical pole, poles reaches its maximum axial tilt, tilt away from the Sun. This happens twice yearly, once in each hemisphere (Northern Hemisphere, Northern and So ...
s. Historical sources record several such qiblas, for example: sunrise at the equinoxes (due east) in
the Maghreb, sunset at the equinoxes (due west) in India, the origin of the
north wind or the fixed location of the
North Star in Yemen, the rising point of the star (
Canopus
Canopus is the brightest star in the southern constellation of Carina (constellation), Carina and the list of brightest stars, second-brightest star in the night sky. It is also Bayer designation, designated α Carinae, which is Rom ...
) in Syria, and the midwinter sunset in Iraq. Such directions appear in texts of (Islamic jurisprudence) and texts of folk astronomy. Astronomers (aside from folk astronomers) typically do not comment on these methods, but they were not opposed by Islamic legal scholars. The traditional directions were still in use when methods were developed to calculate the qibla more accurately, and they still appear in some surviving medieval mosques today.
With astronomy
The study of astronomy—known as ("science of the celestial orbs") in the Islamic intellectual tradition—began to appear in the Islamic World in the second half of the 8th century, centred in Baghdad, the principal city of the
Abbasid Caliphate
The Abbasid Caliphate or Abbasid Empire (; ) was the third caliphate to succeed the Islamic prophet Muhammad. It was founded by a dynasty descended from Muhammad's uncle, Abbas ibn Abd al-Muttalib (566–653 CE), from whom the dynasty takes ...
. Initially, the science was introduced through the works of Indian authors, but after the 9th century the works of Greek astronomers such as
Ptolemy
Claudius Ptolemy (; , ; ; – 160s/170s AD) was a Greco-Roman mathematician, astronomer, astrologer, geographer, and music theorist who wrote about a dozen scientific treatises, three of which were important to later Byzantine science, Byzant ...
were translated into Arabic and became the main references in the field. Muslim astronomers preferred Greek astronomy because they considered it to be better supported by theoretical explanations and therefore it could be developed as an exact science; however, the influence of Indian astronomy survives especially in the compilation of astronomical tables. This new science was applied to develop new methods of determining the qibla, making use of the concept of latitude and longitude taken from Ptolemy's ''
Geography
Geography (from Ancient Greek ; combining 'Earth' and 'write', literally 'Earth writing') is the study of the lands, features, inhabitants, and phenomena of Earth. Geography is an all-encompassing discipline that seeks an understanding o ...
'' as well as trigonometric formulae developed by Muslim scholars. Most textbooks of astronomy written in the medieval Islamic World contain a chapter on the determination of the qibla, considered one of the many things connecting astronomy with
Islamic law
Sharia, Sharī'ah, Shari'a, or Shariah () is a body of religious law that forms a part of the Islamic tradition based on scriptures of Islam, particularly the Qur'an and hadith. In Islamic terminology ''sharīʿah'' refers to immutable, intan ...
(sharia). According to David A. King, various medieval solutions for the determination of the qibla "bear witness to the development of mathematical methods from the 3rd/9th to the 8th/14th centuries and to the level of sophistication in trigonometry and computational techniques attained by these scholars".
The first mathematical methods developed in the early 9th century were approximate solutions to the mathematical problem, usually using a flat map or two-dimensional geometry. Since in reality the Earth is spherical, the directions found were inexact, but they were sufficient for locations relatively close to Mecca (including as far away as Egypt and Iran) because the errors were less than 2°.
Exact solutions, based on three-dimensional geometry and spherical trigonometry, began to appear in the mid-9th century.
Habash al-Hasib wrote an early example, using an
orthographic projection
Orthographic projection (also orthogonal projection and analemma) is a means of representing Three-dimensional space, three-dimensional objects in Plane (mathematics), two dimensions. Orthographic projection is a form of parallel projection in ...
. Another group of solutions uses trigonometric formulas, for example
Al-Nayrizi's four-step application of
Menelaus's theorem. Subsequent scholars, including Ibn Yunus, Abu al-Wafa, Ibn al-Haitham and Al-Biruni, proposed other methods which are confirmed to be accurate from the viewpoint of modern astronomy.
Muslim astronomers subsequently used these methods to compile tables showing the qibla from a list of locations, grouped by their latitude and longitude differences from Mecca. The oldest known example, from Baghdad, contained entries for each degree and
arc minute up to 20°. In the 14th century,
Shams al-Din al-Khalili, an astronomer who served as a (timekeeper) in the
Umayyad Mosque
The Umayyad Mosque (; ), also known as the Great Mosque of Damascus, located in the old city of Damascus, the capital of Syria, is one of the largest and oldest mosques in the world. Its religious importance stems from the eschatological reports ...
of Damascus, compiled a qibla table for 2,880 coordinates with longitude differences of up to 60° from Mecca, and with latitudes ranging from 10° to 50°. King opines that among the medieval qibla tables, al-Khalili's work is "the most impressive from the view of its scope and its accuracy".
The accuracy of applying these methods to actual locations depend on the accuracy of its input parameters—the local latitude and the latitude of Mecca, and the longitude difference. At the time of the development of these methods, the latitude of a location could be determined to several arc minutes' accuracy, but there was no accurate method to determine a location's longitude. Common methods used to estimate the longitude difference included comparing the local timing of a
lunar eclipse
A lunar eclipse is an astronomical event that occurs when the Moon moves into the Earth's shadow, causing the Moon to be darkened. Such an alignment occurs during an eclipse season, approximately every six months, during the full moon phase, ...
versus the timing in Mecca, or measuring the distance of caravan routes; the Central Asian scholar Al-Biruni made his estimate by averaging various approximate methods. Because of longitudinal inaccuracy, medieval qibla calculations (including those using mathematically accurate methods) differ from the modern values. For example, while the
Al-Azhar Mosque in Cairo was built using the "qibla of the astronomers", but the mosque's qibla (127°) differs somewhat from the results of modern calculations (135°) because the longitude difference used was off by three degrees.
Accurate longitude values in the Islamic world were available only after the application of
cartographic surveys in the 18th and 19th centuries. Modern coordinates, along with new technologies such as
GPS satellites and electronic instruments, resulted in the development of practical instruments to calculate the qibla. The qibla found using modern instruments might differ from the direction of mosques, because a mosque might be built before the advent of modern data, and orientation inaccuracies might have been introduced during the building process of modern mosques. When this is known, sometimes the direction of the mosque's ''mihrab'' is still observed, and sometimes a marker is added (such as lines drawn in the mosque) that can be followed instead of the ''mihrab''.
Instruments
Muslims use various instruments to find the qibla direction when not near a mosque. The
qibla compass is a magnetic compass which includes a table or a list of qibla angles from major settlements. Some electronic versions use satellite coordinates to calculate and indicate the qibla automatically. Qibla compasses have existed since around 1300, supplemented by the list of qibla angles often written on the instruments themselves. Hotel rooms with Muslim guests may use a sticker showing the qibla on the ceiling or a drawer. With the advent of computing, various
mobile app
A mobile application or app is a computer program or software application designed to run on a mobile device such as a smartphone, phone, tablet computer, tablet, or smartwatch, watch. Mobile applications often stand in contrast to desktop appli ...
s and websites use formulae to calculate the qibla for their users.
Diversity
Early Islamic world

Because varying methods have been used to determine the qibla, mosques were built throughout history in different directions, including some that still stand today. Methods based on astronomy and mathematics were not always used, and the same determination method could yield different qiblas due to differences in the accuracy of data and calculations. Egyptian historian
Al-Maqrizi (d. 1442) recorded various qibla angles used in Cairo at the time: 90° (due east), 117° (winter sunrise, the "qibla of the sahaba"), 127° (calculated by astronomers, such as Ibn Yunus), 141° (
Mosque of Ibn Tulun), 156° (the rising point of Suhayl/Canopus), 180° (due south, emulating the qibla of Muhammad in Medina), and 204° (the setting point of Canopus). The modern qibla for Cairo is 135°, which was not known at the time. This diversity also results in the non-uniform layout in Cairo's districts, because the streets are often oriented according to the varying orientation of the mosques. Historical records also indicate the diversity of qiblas in other major cities, including
Córdoba (113°, 120°, 135°, 150°, and 180° were recorded in the 12th century) and
Samarkand
Samarkand ( ; Uzbek language, Uzbek and Tajik language, Tajik: Самарқанд / Samarqand, ) is a city in southeastern Uzbekistan and among the List of oldest continuously inhabited cities, oldest continuously inhabited cities in Central As ...
(180°, 225°, 230°, 240°, and 270° were recorded in the 11th century). According to the doctrine of , the diverse directions of qiblas are still valid as long as they are still in the same broad direction.
In 1990, the scholar of geography Michael E. Bonine conducted a survey of the main mosques of all major cities in present-day Morocco—constructed from the
Idrisid period (8th–10th centuries) up to the
Alawi period (17th century to present). While modern calculations yield the qiblas of between 91° (almost due east) in Marrakesh and 97° in Tangier, only mosques constructed in the Alaouite period are constructed with qiblas relatively close to this range. The qibla of older mosques vary considerably, with concentrations occurring between 155°–160° (slightly east of south) as well as 120°–130° (almost southeast). In 2008, Bonine also published a survey of the main city mosques of Tunisia, in which he found that most were aligned close to 147°. This is the direction of the
Great Mosque of Kairouan, originally built in 670 and last rebuilt by the
Aghlabids
The Aghlabid dynasty () was an Arab dynasty centered in Ifriqiya (roughly present-day Tunisia) from 800 to 909 that conquered parts of Sicily, Southern Italy, and possibly Sardinia, nominally as vassals of the Abbasid Caliphate. The Aghlabids ...
in 862, which is often credited as the model used by the other mosques. Among the mosques surveyed, the
Great Mosque of Sousse was the only one with a significant difference, facing further south at 163°. The actual direction to Mecca as calculated using the great circle method ranges from 110° to 113° throughout the country.
Indonesia
Variations of the qibla also occur in Indonesia, the country with the world's largest Muslim population. The astronomically calculated qibla ranges from 291°—295° (21°—25° north of west) depending on the exact location in the archipelago. However, the qibla is often known traditionally simply as "the west", resulting in mosques built oriented due west or to the direction of sunset—which varies slightly throughout the year. Different opinions exist among Indonesian Islamic astronomers: Tono Saksono ''et al.'' argues in 2018 that facing the qibla during prayers is more of a "spiritual prerequisite" than a precise physical one, and that an exact direction to the Kaaba itself from thousands of kilometres away requires an extreme precision impossible to achieve when building a mosque or when standing for prayers. On the other hand, Muhammad Hadi Bashori in 2014 opines that "correcting the qibla is indeed a very urgent thing", and can be guided by simple methods such as observing the shadow.
In the history of the region, disputes about the qibla had also occurred in the then-
Dutch East Indies
The Dutch East Indies, also known as the Netherlands East Indies (; ), was a Dutch Empire, Dutch colony with territory mostly comprising the modern state of Indonesia, which Proclamation of Indonesian Independence, declared independence on 17 Au ...
in the 1890s. When the Indonesian scholar and future founder of
Muhammadiyah,
Ahmad Dahlan, returned from his Islamic and astronomy studies in Mecca, he found that mosques in the royal capital of Yogyakarta had inaccurate qiblas, including the
Kauman Great Mosque, which faced due west. His efforts in adjusting the qibla were opposed by the traditional ''ulama'' of the
Yogyakarta Sultanate, and a new mosque built by Dahlan using his calculations was demolished by a mob. Dahlan rebuilt his mosque in the 1900s, and later the Kauman Great Mosque would also be reoriented using the astronomically calculated qibla.
North America

For locations outside of historic Muslim communities, determination of the qibla can be a matter of debate. The
Islamic Center of Washington, D.C. was built in 1953 facing slightly north of east and initially puzzled some observers, including Muslims, because
Washington, D.C.'s latitude is 17°30′ north of Mecca. Even though a line drawn on world maps—such as those using the Mercator projection—would suggest a southeastern direction to Mecca, the astronomical calculation using the great circle method does yield a north-of-east direction (56°33′). Nevertheless, most early mosques in the United States face east or southeast, following the apparent direction on world maps. In 1978, an American Muslim scientist, S. Kamal Abdali, wrote a book arguing that the correct qibla from North America was north or northeast as calculated by the great circle method which identifies the shortest path to Mecca. This conclusion was widely circulated and then accepted by the Muslim community, and mosques were subsequently reoriented as a result. In 1993, two religious scholars, Riad Nachef and Samir Kadi, published a book arguing for a southeastern qibla, writing that the north/northeast qibla was invalid and resulted from a lack of religious knowledge. In reaction, Abdali published a response to their arguments and criticism in an article entitled "The Correct Qibla" online in 1997. The two opinions resulted in a period of debate about the correct qibla. Eventually most North American Muslims accepted the north/northeast qibla with a minority following the east/southeast qibla.
Space and ISS

The
International Space Station
The International Space Station (ISS) is a large space station that was Assembly of the International Space Station, assembled and is maintained in low Earth orbit by a collaboration of five space agencies and their contractors: NASA (United ...
(ISS) orbits the Earth at high speed—the direction from it to Mecca changes significantly within a few seconds. Before his flight to the ISS,
Sheikh Muszaphar Shukor requested, and the Malaysian National Fatwa Council provided, guidelines which have been translated into multiple languages. The council wrote that the qibla determination should be "based on what is possible" and recommended four options, saying that one should pray toward the first option if possible and, if not, fall back successively on the later ones:
# the Kaaba itself
# the position directly above the Kaaba at the altitude of the astronaut's orbit
# the Earth in general
# "wherever"
In line with the fatwa council, other Muslim scholars argue for the importance of flexibility and adapting the qibla requirement to what an astronaut is capable of fulfilling. Khaleel Muhammad of
San Diego State University
San Diego State University (SDSU) is a Public university, public research university in San Diego, California, United States. Founded in 1897, it is the third-oldest university and southernmost in the 23-member California State University (CS ...
opined "God does not take a person to task for that which is beyond his/her ability to work with." Kamal Abdali argued that concentration during a prayer is more important than the exact orientation, and he suggested keeping the qibla direction at the start of a prayer instead of "worrying about possible changes in position". Before Sheikh Muszaphar's mission, at least eight Muslims had flown to space, but none of them publicly discussed issues relating to worship in space.
See also
*
Direction of prayer
** ''
Mizrah'', the direction of prayer in the
Jewish faith
** ''
Ad orientem'', comparable concept in traditional
Christianity
Christianity is an Abrahamic monotheistic religion, which states that Jesus in Christianity, Jesus is the Son of God (Christianity), Son of God and Resurrection of Jesus, rose from the dead after his Crucifixion of Jesus, crucifixion, whose ...
** ''
Qiblih'', the
Baháʼí direction of prayer
*
Orientation of churches
The orientation of a building refers to the direction in which it is constructed and laid out, taking account of its planned purpose and ease of use for its occupants, its relation to the path of the sun and other aspects of its environment. In c ...
*
Spatial deixis, spatial orientation relevant to an utterance
Notes
References
Citations
Bibliography
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
External links
*
*
*
{{featured article
Salah
Mosque architecture
Islamic architecture
Islamic architectural elements
Arabic words and phrases
Kaaba
Salah terminology
Orientation (geometry)