It is Sunnah to perform the Tahiyyat al-Masjid prayer upon entering the mosque. Indeed, the Prophet (peace be upon him) said regarding this prayer: “When one of you enters the mosque, let him pray two rak‘ahs before sitting down.” (Bukhari, Salat, 60 [444]; Muslim, Salat al-Musafirin, 69 [714])
According to the Hanafi school, Tahiyyat al-Masjid is performed as two or four rak‘ahs, while the Malikis perform two rak‘ahs. For the Shafi‘i school, the original practice is two rak‘ahs, but both Shafi‘i and Hanbali scholars state that one may perform as many rak‘ahs as desired with this intention.
The Hanafis hold that Tahiyyat al-Masjid cannot be performed during times when voluntary prayers are considered disliked (makruh). The Shafi‘is, however, consider Tahiyyat al-Masjid to be a nafl prayer tied to a specific cause, so it may be performed even during these times. (Shirbini, Mughni al-Muhtaj, 1/311)
If a person enters the mosque while the adhan is being called, it is considered makruh by the Hanafis to perform this prayer, whereas it is not makruh according to the Shafi‘is. However, there is consensus among jurists that it is makruh for someone entering the mosque while the iqamah is being called or the congregational prayer has started to perform Tahiyyat al-Masjid.
The Hanafis state that if someone enters the mosque while the Friday preacher is on the pulpit, he should sit and listen to the sermon, and it is makruh to perform Tahiyyat al-Masjid. The Shafi‘is, however, say it should be performed as long as it is not prolonged and does not exceed two rak‘ahs.
If a person entering the mosque is unable to perform this prayer due to being occupied or because it is a disliked time, it is recommended (mustahabb) to say: “Subhanallahi wa’l-hamdu lillahi wa la ilaha illallahu wallahu akbar”; some scholars also add: “wa la hawla wa la quwwata illa billahi’l-‘aliyyi’l-azim.”
The Hanafis state that fulfilling the right of the mosque can also be achieved by performing any prayer or joining the congregational obligatory prayer. Thus, if a person enters the mosque with the intention of performing at least two rak‘ahs of obligatory or voluntary prayer, this prayer will count as Tahiyyat al-Masjid even if he does not specifically intend it, and he will receive its reward. (Kasani, Bada’i‘, 1/190, 191; Ibn Abidin, Radd al-Muhtar, 2/18)
The greeting of Masjid al-Haram is to perform tawaf of the Ka‘bah; one who enters with the intention of tawaf should begin tawaf immediately, while one who enters without the intention of tawaf should perform Tahiyyat al-Masjid.
Source: T.C. Diyanet İşleri Başkanlığı, Din İşleri Yüksek Kurulu
This content was drafted with AI assistance and reviewed by an editor.