Short answer
Yes, but separate prayers are better in the Hanafi school. One janazah prayer can be prayed for several deceased people together if needed. Their bodies are placed in a row in front of the imam, and the dua is made for all of them.
A single funeral prayer is valid for any number of bodies placed together, though praying for each one separately is better. In a mixed group the rows run men, boys, women, girls, and the imam makes the adult dua first and then the children's dua.
The four schools agree on this.
Explanation
There is no requirement to pray a separate janazah for each person. If several Muslims die together, such as in an accident, an epidemic or a disaster, the community can pray once for all of them. The bodies are placed in a row in front of the imam, with the dua said for everyone, using the plural.
Practical points:
- Arrangement: all bodies face the qiblah. Hanafi books put men nearest to the imam, then boys, then women, then girls, with the imam's chest in line with the bodies. If the arrangement is not practical, the prayer remains valid.
- Each body must be washed and shrouded before the prayer, or the rules for a martyr or an incomplete body apply. See martyrs and a body that is incomplete.
- The intention is for all the dead in front of you.
- Separate prayers for each body are better in the Hanafi school, though one prayer for all is allowed.
The dua in the prayer: for adults, the dua for forgiveness is changed to the plural. For a child, the dua is different; see the child's janazah dua.
Where the ruling is recorded
- al-Hidaya, Kitab al-Salah, Bab al-Jana'iz. Several dead may be prayed over together in one prayer, arranged in a row.
- Radd al-Muhtar (Ibn Abidin), Kitab al-Salah, Bab al-Jana'iz. Arrangement of several bodies in one prayer.
Reviewed by Hafez Mawlana Abu Darda and Mawlana Akramul Haque Fenwi, Islamic scholars. For a more accurate answer to your own situation, consult a scholar. Quran translation by Saheeh International. Hadith: selections from sunnah.com, 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.