Short answer
Not in the Hanafi school. The janazah prayer needs the body to be present in front of the people praying. The Shafi'i and Hanbali schools allow praying janazah for someone who died in another place. In all schools you can make dua for them anywhere.
Janazah in absentia (salat al-ghaib) is not valid, since the presence of the body in front of the imam is a condition. The Prophet's ﷺ prayer over the Negus (al-Najashi) is explained as a special case. If someone was buried without a janazah, it may be prayed at the grave while the body is thought to be intact.
Other madhhabs
- Shafi'i
- Praying janazah for an absent person in another town is valid.
- Hanbali
- Valid for an absent person, within about a month of burial.
Explanation
When a relative dies in another city or country, people often ask whether they can pray the janazah where they are. The Maliki school agrees with the Hanafi school that the prayer needs the body to be present. The Shafi'i and Hanbali schools allow it.
The evidence. The Prophet ﷺ prayed janazah in Madinah for the Negus, the king of Abyssinia, on the day he died there. The Shafi'is and Hanbalis take this as a general rule. Hanafi and Maliki scholars note that many Companions died away from Madinah and he did not pray for them in absentia. They read the case of the Negus as special, since he died in a land where no one may have prayed over him.
What to do as a Hanafi:
- Make dua for the person, as much as you wish, alone or in a gathering.
- Give sadaqah and recite Quran for them; see gifting reward to the dead.
- If you are in a community where others pray it following another school, you do not need to argue with them. Each follows their scholars.
Praying at the grave. If a Muslim was buried without any janazah, Hanafis say the prayer may be offered at the grave, for as long as the body is thought not to have decayed, a period scholars leave to local judgement. The Prophet ﷺ prayed at the grave of a woman who used to clean the mosque, because he had not been told of her death. If the janazah was already prayed by the guardian, it is not repeated.
For the steps of the prayer itself, see how to pray janazah.
The evidence
Quran, Surah Muhammad 47:19
فَٱعْلَمْ أَنَّهُۥ لَآ إِلَٰهَ إِلَّا ٱللَّهُ وَٱسْتَغْفِرْ لِذَنۢبِكَ وَلِلْمُؤْمِنِينَ وَٱلْمُؤْمِنَٰتِ ۗ وَٱللَّهُ يَعْلَمُ مُتَقَلَّبَكُمْ وَمَثْوَىٰكُمْ ﴿١٩﴾
So know, [O Muhammad], that there is no deity except Allah and ask forgiveness for your sin and for the believing men and believing women. And Allah knows of your movement and your resting place.
Dua for absent believers is open to everyone in every school.
Sahih al-Bukhari 1320
Sahih... قد توفي اليوم رجل صالح من الحبش فهلم فصلوا عليه ...
"A righteous man from Abyssinia has died today, so come and pray over him."
This is the case of the Negus that the schools read differently.
Sahih al-Bukhari 1337
Sahih... دلوني على قبره ...
"Show me his grave."
The Prophet ﷺ prayed at the grave of someone buried without his knowledge.
Where the ruling is recorded
- Bada'i al-Sana'i, Kitab al-Salah, chapter on the janazah prayer. The body's presence as a condition of the prayer.
- Radd al-Muhtar (Ibn Abidin), Kitab al-Salah, Bab Salat al-Janazah. The case of the Negus and praying at the grave.
- al-Mughni (Ibn Qudama), Kitab al-Jana'iz. The Hanbali view on prayer for the absent.
This answer is pending review by the scholars on our team. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.