This is a complete guide to the janazah prayer in Masjid al-Haram and Masjid an-Nabawi: the niyyah, what to recite after each of the four takbirs, what to do if you are late, and what to do if you do not know who the deceased are, according to the Shafi‘i school. May it help you, in sha Allah.
Editorial review: 16 October 2026 · English edition: 4 December 2026 · Expert fiqh review: in progress · Main references: Sahih Muslim, al-Adhkar and al-Majmu‘ (al-Nawawi), Tuhfat al-Muhtaj (Mustafa Sumait’s abridgement), Mughni al-Muhtaj and the Federal Territory Mufti Office (Malaysia).
Summary
When the imam gives salam after the obligatory prayer and a janazah prayer is announced, stay in your row and stand. Make the niyyah in your heart: I pray over the deceased whom the imam is praying over, four takbirs, as a communal obligation, as a follower, for the sake of Allah the Most High. You do not need to know whether the deceased is male or female, or how many there are.
Takbir 1: al-Fatihah. Takbir 2: salawat. Takbir 3: Allāhummaghfir lahum warhamhum wa ‘āfihim wa‘fu ‘anhum. Takbir 4: dua. Then salam. There is no bowing and no prostration. Follow the five steps below.
Follow these steps
How to Pray the Janazah Prayer in Masjid al-Haram and Masjid an-Nabawi, Step by Step
A janazah prayer is held after almost every obligatory prayer in both mosques. Read the cards below before the obligatory prayer ends. During the prayer, you only need to remember the order: takbir 1 al-Fatihah, takbir 2 salawat, takbir 3 dua for the deceased, takbir 4 dua, then salam.
If this happens
- You do not know whether the deceased is male or female, or how many there are? You do not need to know. Use the general niyyah in step 1 and the dua with lahum.
- You are late and the imam has already said a takbir? Make the niyyah, say the takbir and recite al-Fatihah. After the imam gives salam, complete the remaining takbirs on your own (see If You Are Late, Miss a Takbir or Make a Mistake in the Niyyah). If the imam says the next takbir before you finish al-Fatihah, leave the rest of the recitation and say the takbir with the imam.
- You have been with the imam from the first takbir, but he says the next takbir before you finish reciting? Finish al-Fatihah, then say the takbir and catch up with the imam. Slow recitation counts as a valid excuse (see If You Are Late, Miss a Takbir or Make a Mistake in the Niyyah).
- A child’s janazah is announced? After the dua of takbir 3, add the dua for a child (step 3).
- You have no wudu or are in the middle of a voluntary prayer? You do not need to join. The janazah prayer is a communal obligation and is being performed by the other worshippers.
As soon as the imam gives salam after the obligatory prayer
Do not stand up for a voluntary prayer. The rawatib after the obligatory prayer can be prayed after the janazah prayer.
Listen for the short announcement in Arabic, such as as-salātu ‘alal-amwāt (prayer over the deceased).
Stay in your row and stand with the imam. You do not need to see the deceased.
Still have rak‘ahs of the obligatory prayer to make up? Do not break off your obligatory prayer. Complete it first. If the janazah prayer is still going on after your salam, join as a late follower.
Say each takbir as soon as the imam does. Falling a full takbir behind without an excuse invalidates the prayer.
1
Takbir 1 of 4
Niyyah and al-Fatihah
Make the niyyah, then say the takbir
Say this niyyah quietly before the imam says the takbir:
Niyyah for the janazah prayer (general)Niyyah wording
أُصَلِّي عَلَى مَنْ يُصَلِّي عَلَيْهِ الْإِمَامُ أَرْبَعَ تَكْبِيرَاتٍ فَرْضَ كِفَايَةٍ مَأْمُومًا لِلَّهِ تَعَالَى
Usallī ‘alā man yusallī ‘alaihil-imāmu arba‘a takbīrātin fardha kifāyatin ma’mūman lillāhi ta‘ālā.
I pray over the deceased whom the imam is praying over, four takbirs, as a communal obligation, as a follower, for the sake of Allah the Most High.
This wording mentions neither gender nor number. The marker “whom the imam is praying over” is enough (Tuhfat al-Muhtaj). The niyyah in the heart is a pillar. Saying it aloud is sunnah.
Raise your hands and say the takbir with the imam: Allāhu akbar. As you say the takbir, hold that niyyah in your heart. A niyyah made in your own language is also valid.
Recite al-Fatihah
Place your hands below your chest. There is no opening dua (iftitah). Go straight to al-Fatihah and recite it quietly:
Surah al-Fatihah (pillar)Quran
بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ ١ ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَـٰلَمِينَ ٢ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ ٣ مَـٰلِكِ يَوْمِ ٱلدِّينِ ٤ إِيَّاكَ نَعْبُدُ وَإِيَّاكَ نَسْتَعِينُ ٥ ٱهْدِنَا ٱلصِّرَٰطَ ٱلْمُسْتَقِيمَ ٦ صِرَٰطَ ٱلَّذِينَ أَنْعَمْتَ عَلَيْهِمْ غَيْرِ ٱلْمَغْضُوبِ عَلَيْهِمْ وَلَا ٱلضَّآلِّينَ ٧
Bismillāhir-rahmānir-rahīm. Alhamdu lillāhi rabbil-‘ālamīn. Ar-rahmānir-rahīm. Māliki yawmid-dīn. Iyyāka na‘budu wa iyyāka nasta‘īn. Ihdinas-sirātal-mustaqīm. Sirātal-ladhīna an‘amta ‘alaihim, ghairil-maghdūbi ‘alaihim wa lad-dāllīn.
Meaning and source
In the name of Allah, the Most Compassionate, the Most Merciful. All praise is for Allah, Lord of all the worlds, the Most Compassionate, the Most Merciful, Master of the Day of Judgement. You alone we worship, and You alone we ask for help. Guide us to the straight path, the path of those You have blessed, not of those who have earned Your anger, nor of those who have gone astray.
Surah al-Fatihah, verses 1 to 7 (quran.com).
Takbir 1 ends when the imam says the next takbir. Takbir 2 ↓
2
Takbir 2 of 4
Salawat
Say the takbir, then recite the salawat
Raise your hands and say the takbir with the imam. Then recite at least:
Salawat (pillar)Composed by scholars
اللَّهُمَّ صَلِّ عَلَى سَيِّدِنَا مُحَمَّدٍ
Allāhumma salli ‘alā sayyidinā Muhammad.
O Allah, send blessings upon our master Muhammad.
The minimum salawat according to al-Adhkar. The word sayyidinā (our master) is a customary courtesy in Malaysia.
If there is still time, continue with the Salawat Ibrahimiyyah (Durood-e-Ibrahim).
Takbir 2 ends when the imam says the next takbir. Takbir 3 ↓
3
Takbir 3 of 4
Dua for the deceased
Say the takbir, then make dua for the deceased
Raise your hands and say the takbir with the imam. Then recite:
Dua for the deceased (pillar)Based on an authentic hadith
اللَّهُمَّ اغْفِرْ لَهُمْ وَارْحَمْهُمْ وَعَافِهِمْ وَاعْفُ عَنْهُمْ
Allāhummaghfir lahum warhamhum wa ‘āfihim wa‘fu ‘anhum.
O Allah, forgive them, have mercy on them, keep them safe and pardon them.
The opening of the Prophet’s ﷺ dua in the janazah prayer, Sahih Muslim, no. 963, in the plural form (lahum). Suitable when there are many deceased or you do not know who they are. See the pronoun table.
If a child’s janazah is announced (optional)
After the dua above, add this dua for the child’s parents:
Dua for a child’s janazahComposed by scholars
اللَّهُمَّ اجْعَلْهُ لَهُمَا فَرَطًا، وَاجْعَلْهُ لَهُمَا سَلَفًا، وَاجْعَلْهُ لَهُمَا ذُخْرًا، وَثَقِّلْ بِهِ مَوَازِينَهُمَا، وَأَفْرِغِ الصَّبْرَ عَلَى قُلُوبِهِمَا، وَلَا تَفْتِنْهُمَا بَعْدَهُ، وَلَا تَحْرِمْهُمَا أَجْرَهُ
Allāhummaj‘alhu lahumā faratan, waj‘alhu lahumā salafan, waj‘alhu lahumā dhukhran, wa thaqqil bihī mawāzīnahumā, wa afrighis-sabra ‘alā qulūbihimā, wa lā taftinhumā ba‘dahu, wa lā tahrimhumā ajrahu.
Meaning and source
O Allah, make him a forerunner for his parents, a reward stored up for them, make their scales heavy through him, pour patience into their hearts, do not test them after him, and do not deprive them of his reward.
Al-Nawawi, al-Adhkar: the wording of al-Zubairi in al-Kafi, a scholar of the Shafi‘i school. Composed by scholars, not a hadith.
Takbir 3 ends when the imam says the next takbir. Takbir 4 ↓
4
Takbir 4 of 4
Closing dua
Say the takbir, then recite the dua
Raise your hands and say the takbir with the imam. Then recite:
Dua after the fourth takbir (sunnah)Combined dua
اللَّهُمَّ لَا تَحْرِمْنَا أَجْرَهُمْ وَلَا تَفْتِنَّا بَعْدَهُمْ وَاغْفِرْ لَنَا وَلَهُمْ
Allāhumma lā tahrimnā ajrahum wa lā taftinnā ba‘dahum waghfir lanā wa lahum.
O Allah, do not deprive us of the reward (of praying over) them, do not test us after them, and forgive us and them.
The wording recommended by Imam al-Shafi‘i (al-Adhkar), in the plural form. The addition waghfir lanā wa lahum is quoted from Shafi‘i scholars in al-Majmu‘.
This dua is sunnah. If the imam gives salam before you finish, give salam with the imam straight away.
Takbir 4 ends when the imam gives salam. Salam ↓
5
Salam
Ending the prayer
Give salam
Turn your head to the right and give salam, then to the left:
السَّلَامُ عَلَيْكُمْ وَرَحْمَةُ اللَّهِ
Assalāmu ‘alaikum wa rahmatullāh.
Peace and the mercy of Allah be upon you.
The first salam is a pillar. The second salam is sunnah.
After the salam
If you wish, pray the sunnah rawatib of the obligatory prayer you postponed.
A late follower does not give salam with the imam. He first completes his remaining takbirs (see If You Are Late, Miss a Takbir or Make a Mistake in the Niyyah).
Given salam? The janazah prayer is complete. Alhamdulillah.
If something goes wrong
If You Are Late, Miss a Takbir or Make a Mistake in the Niyyah
Answer finder
What happened to you?
Niyyah and pronouns
The Niyyah and Dua When You Do Not Know Who the Deceased Are
In Masjid al-Haram and Masjid an-Nabawi, there is usually more than one deceased, a mix of men, women and children. Worshippers in the back rows cannot see them.
- You do not have to identify the deceased. In the Shafi‘i school, you do not need to know who they are, their gender or their number. The most minimal marker is enough, such as “this” or “whom the imam is praying over” (Tuhfat al-Muhtaj).
- Many deceased: intend all of them in general, even if you do not know how many there are.
- Specifying without a pointer and getting it wrong can invalidate the prayer. For example, intending to pray over ten deceased when there are eleven. That is why you should not mention gender or number in the niyyah.
Pronouns in the dua
The duas of takbirs 3 and 4 change according to the deceased. If you are not sure, use lahum.
| Deceased | Pronoun | Dua of takbir 3 |
|---|---|---|
| One man | lahu | Allāhummaghfir lahu warhamhu wa ‘āfihi wa‘fu ‘anhu |
| One woman | lahā | Allāhummaghfir lahā warhamhā wa ‘āfihā wa‘fu ‘anhā |
| Several, or not sure | lahum | Allāhummaghfir lahum warhamhum wa ‘āfihim wa‘fu ‘anhum |
Using the wrong pronoun does not invalidate the dua. According to Mughni al-Muhtaj, the masculine pronoun can be used in the sense of “the deceased person”, and the feminine pronoun in the sense of “the body (al-janazah)”.
Ruling and pillars
Ruling, Pillars and Virtues
The janazah prayer is a communal obligation (fard kifayah). Once some Muslims have performed it, the rest are free of sin. In the Two Holy Mosques it is always performed by thousands of worshippers, so joining it is a chance to earn reward.
The janazah prayer has seven pillars in the Shafi‘i school. The other recitations in the cards above are sunnah.
| Pillar | When | Minimum |
|---|---|---|
| Niyyah | With the first takbir | A janazah prayer, obligatory |
| Standing | Throughout the prayer | For those who are able |
| Four takbirs | Including the opening takbir | Four times |
| Al-Fatihah | Usually after takbir 1 | The whole surah |
| Salawat | After takbir 2 | Allāhumma salli ‘alā Muhammad |
| Dua for the deceased | After takbir 3 | Any dua for the deceased |
| Salam | After takbir 4 | The first salam |
The Prophet ﷺ promised a great reward for whoever prays over the deceased:
مَنْ صَلَّى عَلَى جَنَازَةٍ فَلَهُ قِيرَاطٌ، فَإِنْ شَهِدَ دَفْنَهَا فَلَهُ قِيرَاطَانِ، الْقِيرَاطُ مِثْلُ أُحُدٍ
“Whoever prays over a deceased will have one qirat. If he attends the burial, he will have two qirats. One qirat is like Mount Uhud.”
Sahih Muslim, no. 946, narrated by Thawban (may Allah be pleased with him)
Q&A
Frequently Asked Questions
Do I need to know whether the deceased is male or female to pray the janazah prayer in Masjid al-Haram?
No. In the Shafi‘i school, the niyyah “over the deceased whom the imam is praying over” is enough. Do not mention gender or number in the niyyah, because if you get it wrong without a pointer, the prayer may be invalid. In the dua, use the plural pronoun “lahum”.
What if I am late joining the janazah prayer?
Make the niyyah and say the takbir, then recite al-Fatihah. Follow the imam’s next takbirs. After the imam gives salam, complete your remaining takbirs on your own with their recitations, then give salam.
Can women join the janazah prayer in Masjid al-Haram and Masjid an-Nabawi?
Yes, and their prayer is valid. Women in the women’s prayer areas follow the imam as usual, in the same way.
What is the dua for a child’s janazah?
After the dua of the third takbir, add the dua for the child’s parents quoted by Imam al-Nawawi in al-Adhkar, beginning Allāhummaj‘alhu lahumā faratan (O Allah, make him a forerunner for his parents). The full wording is in step 3. This dua was composed by scholars and is not a hadith.
Can I pray the absent janazah prayer (ghaib) for a family member back home while I am in the Two Holy Mosques?
Yes, according to the Federal Territory Mufti Office, Malaysia (al-Kafi no. 968), provided the deceased has already been washed. Pray it as a separate prayer, on your own, after the janazah prayer with the imam. The four takbirs and their recitations are the same, but the niyyah is different because there is no imam: “I pray over the absent deceased (say the name of the deceased), four takbirs, as a communal obligation, for the sake of Allah the Most High.” It is also enough to specify the deceased in your heart. In the duas of takbirs 3 and 4, use lahu for a man or lahā for a woman.
Can I postpone the sunnah rawatib to join the janazah prayer?
Yes. The time for the rawatib after the obligatory prayer is still long. Join the janazah prayer first, then pray the rawatib.
Sources
References
- The Quran, Surah al-Fatihah, verses 1 to 7. quran.com
- Sahih Muslim, no. 963: the Prophet’s ﷺ dua in the janazah prayer, narrated by ‘Awf ibn Malik (may Allah be pleased with him). sunnah.com
- Sahih Muslim, no. 946: the reward of one and two qirats. sunnah.com
- Al-Nawawi, al-Adhkar, the chapter on the adhkar of the janazah prayer: the recitation after each takbir, the minimum, and the dua for a child. kalemtayeb.com (in Arabic)
- Al-Nawawi, al-Majmu‘ Sharh al-Muhadhdhab, 5/239: the addition waghfir lanā wa lahu, quoted on islamqa.org. islamqa.org
- Mustafa Sumait, Mukhtasar Tuhfat al-Muhtaj bi Sharh al-Minhaj, 1/393 to 396: the niyyah, pillars, duas, the follower who falls behind and the late follower. shamela.ws (in Arabic)
- Al-Khatib al-Shirbini, Mughni al-Muhtaj, 1/343: pronouns when the gender of the deceased is unknown, quoted in NU Online. nu.or.id (in Indonesian)
- Al-Jaziri, al-Fiqh ‘ala al-Madhahib al-Arba‘ah: the niyyah of the janazah prayer in the Shafi‘i school. shamela.ws (in Arabic)
- Federal Territory Mufti Office (Malaysia), al-Kafi li al-Fatawi no. 968: How to Perform the Absent Janazah Prayer. muftiwp.gov.my



