Hadithcore
Riyad as-Salihin, 582

Buraidah (May Allah be pleased with him) reported:

The Prophet (ﷺ) used to teach them (i.e., the Companions) whenever they came out to visit the graveyard to say: "As-salamu 'alaikum ahlad-diyyari minal- Mu'minina wal-Muslimina, wa inna in sha' Allahu bikum lahiqun. As 'alul-laha lana wa-lakumul- 'afiyyah (May you be safe, O inmates of the abodes of the believers and the Muslims, and if Allah pleases, we shall follow you, we pray to Allah for well-being for ourselves and for you)." <b>[Muslim]</b>.

وعن بريدة رضي الله عنه قال‏:‏ كان النبي صلى الله عليه وسلم يعلمهم إذا خرجوا إلى المقابر أن يقول قائلهم‏:‏ “السلام عليكم أهل الديار من المؤمنين والمسلمين وإنا إن شاء الله بكم للاحقون، أسأل الله لنا ولكم العافية” ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏

References1 variant
In-Book Reference
Introduction, Hadith 582
Sharh · explanationclick to expand
<b>Guidance from the Hadiths:</b><br> 1) It is recommended to visit the graves in the lawful manner, without specifying certain days for doing so.<br> 2) A person is advised to make the reported supplications upon visiting the graves, as blessing lies in them. However, if he does not memorize any of the reported supplications, he can supplicate as he wishes.<br> 3) The Prophet (may Allah’s peace and blessings be upon him) was keen to teach his Ummah what is beneficial for them. Knowledge precedes words and deeds.<br> 4) It is a right of the believers in general to receive supplication for them to be forgiven and shown mercy. This is one of the rights of brotherliness that last after death.<br> <br> <b>Benefit:</b><br> Visiting the graves falls under three categories: lawful, innovative, and polytheistic. These were extensively explained by the erudite scholar Hāfiz Hakami (may Allah have mercy upon him) in his work Sullam al-Wusūl Fi Tawhid Allah wa Ittibā‘ al-Rasūl.
Related hadiths3
Compare isnād across 3 related chains →