It was narrated that Abu Hurairah said:
“When the Messenger of Allah (ﷺ) offered the funeral prayer he would say: ‘Allahummaghfir lihayyina wa mayyitina, wa shahidina wa gha’ibina, wa saghirina wa kabirina, wa dhakarina wa unthana. Allahumma man ahyaitahu minna faahyihi ‘alal-Islam, wa man tawaffaytahu minna fa tawaffahu ‘alal- iman. Allahumma la tahrimna ajrahu wa la tudillana ba’dah. [O Allah, forgive our living and our dead, those who are present and those who are absent, our young and our old, our males and our females. O Allah, whomever of us You cause to live, let him live in Islam, and whomever of us You cause to die, let him die in (a state of) faith. O Allah, do not deprive us of his reward, and do not let us go astray after him].’”