Yes — the two rak'ahs on entering the mosque are a confirmed sunnah, and the scholars describe them as one of the most consistently practised acts of the mosque. You should not sit down until you have prayed them, and this holds at any time of day or night, including the times when voluntary prayer is otherwise discouraged. If you arrive and the prayer is already being called, the sunnah prayer before the obligatory one takes their place.
What the two rak'ahs are
They are called tahiyyat al-masjid — the greeting of the mosque. IslamWeb explains the name: the tahiyyah is the greeting or honouring given to a thing, and these two rak'ahs are the worshipper's way of honouring the Lord of the house when he enters it. A person entering a king's house greets the king, not the building; so the one entering the mosque greets Allah with prayer before sitting.
The command is established by the Prophet's ﷺ words:
"When one of you enters the mosque, let him not sit until he has prayed two rak'ahs."— Sahih al-Bukhari 1167 and Sahih Muslim 714, from Abu Qatadah
Shaykh Ibn Baz notes that this narration is agreed upon as authentic (muttafaq 'alayh), and that its wording is general — it covers every time and every entry.
The steps
- Enter with the intention in your heart. Ibn Baz is explicit that you do not say aloud "I intend to pray two rak'ahs of the mosque greeting." The intention belongs to the heart, and speaking it aloud is, in the strongest of the scholars' two views, an innovation (bid'ah) — this applies to wudu and to prayer alike.
- Pray two rak'ahs before you sit. The prohibition on sitting is what gives the act its urgency; the point of the ruling is that you pray before taking your place.
- Keep them short if the situation calls for it. The Prophet ﷺ told the man who entered while he was delivering the Friday sermon to "pray two rak'ahs and make them brief."
- Then sit. Once you have prayed, you may sit and wait for the prayer, study, or rest.
When the time is disliked for prayer
This is where the ruling is most often misunderstood. The two rak'ahs are among the prayers that have a specific cause (dhat asbab) — they are legislated because something happened, namely your entry — and a prayer with a cause is performed even at the times when voluntary prayer is otherwise prohibited.
Ibn Baz applies this to the entry before Maghrib, after 'Asr, and after Fajr: the sunnah is to pray them, because the Prophet's ﷺ command is general and the general command specifies the narrations about disliked times. He compares them to the eclipse prayer and the two rak'ahs after tawaf, both of which are prayed whenever their cause arises.
The same reasoning covers the Friday sermon. Ibn Baz states that you pray the two rak'ahs even if the khateeb is delivering the sermon, since the command is unrestricted.
If you arrive at the time of an obligatory prayer
You do not pray both. The sunnah prayer that precedes the obligatory prayer stands in place of the mosque greeting:
| Your situation | What you pray |
|---|---|
| You enter after the adhan for Dhuhr or Fajr | The regular sunnah before that prayer — it suffices for the greeting |
| You enter before the adhan | The two rak'ahs of greeting |
| You already prayed the regular sunnah at home | The scholars differ; some hold the greeting is no longer required of you |
Ibn Baz gives the reason plainly: the regular sunnah is itself a prayer performed before sitting, so it fulfils the purpose the command was aiming at. Al-Shanqiti, explaining the Hanbali text Zad al-Mustaqni', reports that this is the position of the majority — the two rak'ahs of Fajr's sunnah take the place of the greeting, and you may sit afterwards without praying again.
How often it applies
Every entry is a new entry. Ibn Baz states that if you leave and return several times in a day — twice in the forenoon, or at Dhuhr, 'Asr, or at night — you pray two rak'ahs each time you come in, provided you are in a state of purity.
Purity is the condition. The greeting is not prayed by someone without wudu, since prayer is not accepted without it.
Is it obligatory or recommended?
The scholars differ, and both positions are held by serious authorities.
- The majority position, and the one Ibn Baz and IslamWeb give: it is a sunnah, not an obligation. Ibn Baz states it directly: "The greeting of the mosque is a sunnah, it is not obligatory."
- A strong minority position: it is obligatory. Shaykh Ibn 'Uthaymeen says this view "is strong, there is no doubt about it," and that whoever holds it is not to be criticised. His evidence is that the prohibition on sitting carries the force of prohibition, and that acts of worship — unlike matters of etiquette — are obligatory by default unless a text indicates otherwise. He notes that he himself once held this view before settling on it being recommended, while still refusing to censure those who hold the obligation.
Either way, the practical outcome is the same: pray them.
Key takeaways
- Pray two rak'ahs before sitting whenever you enter the mosque, at any hour, including after 'Asr and after Fajr.
- Do not pronounce the intention aloud — the intention is in the heart, and vocalising it is held to be an innovation.
- If you arrive after the adhan, the regular sunnah prayer before the obligatory one takes the place of the greeting.
- Every separate entry calls for its own two rak'ahs, as long as you are in a state of purity.
- The greeting is specific to the mosque — it is not prayed on entering a home or an ordinary prayer room.
Further reading
- Shaykh Ibn Baz, Majmu' Fatawa wa Maqalat, the sections on the greeting of the mosque
- Shaykh Ibn 'Uthaymeen, Liqa' al-Bab al-Maftuh
- Al-Shanqiti, Sharh Zad al-Mustaqni', the chapter on the conditions of prayer
And Allah knows best.
This is a guide to what the scholars have said, not a fatwa. For your own situation, ask a qualified scholar who can hear the details.