The du'a for entering the mosque is: "O Allah, open for me the doors of Your mercy." You say it as you step in with your right foot, and the Sunnah adds that you greet the Prophet ﷺ first. When you leave, the wording changes to asking from His bounty.
The du'a itself
اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ"O Allah, open for me the doors of Your mercy."— Sahih Muslim 713, from Abu Humayd al-Sa'idi
This is the shortest and most firmly established form. The Prophet ﷺ said that when one of you enters the mosque he should greet the Prophet ﷺ and then say these words, and when he leaves he should say: "O Allah, I ask You of Your bounty."
What the words mean
The scholars explain the pairing of mercy on entering and bounty on leaving as deliberate. Entering the mosque is for seeking mercy and forgiveness, so the du'a asks for rahmah (mercy). Leaving means going back out to seek your livelihood, and that is what "bounty" (fadl) refers to. Al-Sindi notes that the Prophet ﷺ is mentioned in this du'a because he ﷺ is the reason a person reaches the mosque and the great good found in it — so it is fitting to remember him with good.
The fuller wording
A narration from Fatimah رضي الله عنها gives a longer version:
"In the name of Allah, and peace be upon the Messenger of Allah. O Allah, forgive me my sins and open for me the doors of Your mercy."— Sunan Ibn Majah 771, from Fatimah bint Rasulillah ﷺ
On leaving, that narration has: "O Allah, forgive me my sins and open for me the doors of Your bounty." Al-Tirmidhi graded the Fatimah narration hasan, though its chain is not connected — Fatimah the Younger did not meet Fatimah the Elder. Al-Albani graded it sahih.
The wording with seeking refuge
A third narration, from Abu Hurayrah رضي الله عنه, adds a seeking of refuge:
"When one of you enters the mosque, let him greet the Prophet and say: O Allah, open for me the doors of Your mercy. And when he leaves, let him greet the Prophet and say: O Allah, protect me from the accursed devil."— Sunan Ibn Majah 773, from Abu Hurayrah
Al-Busiri called this chain sahih, its narrators trustworthy, and al-Hakim said it is sahih on the condition of al-Bukhari and Muslim. Ibn Khuzaymah recorded it in his Sahih under the chapter on the du'a when entering the mosque.
Which one to say
Any of these is sound, and they may be combined. The scholars of hadith did not treat them as competing — they are different narrations of the same occasion, and a person may say the short form, or the fuller one, or add the seeking of refuge.
| Occasion | Wording |
|---|---|
| Entering | "O Allah, open for me the doors of Your mercy" |
| Leaving | "O Allah, I ask You of Your bounty" |
Key takeaways
- Say it with the right foot first, as the Prophet ﷺ began with his right foot when entering.
- Greet the Prophet ﷺ before the du'a — the narration orders the greeting, then the request for mercy.
- The wording differs on entering and leaving: mercy when you enter, bounty when you leave.
- The shortest form is enough, and the longer narrations may be added to it.
- The du'a is a request for mercy, not merely a formula — the scholars tie the wording to what the mosque is for.
Further reading
- Sahih Muslim, the chapter on the du'a when entering the mosque
- Sunan Ibn Majah, Kitab al-Masajid wa al-Jama'at
- Sahih Ibn Khuzaymah, Kitab al-Manasik
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.