All four schools of Islamic jurisprudence agree that it is جائز to perform الحج on behalf of a deceased person who either had the obligation of الحج but did not perform it, or as a voluntary act of devotion whose reward is gifted to the deceased. This ruling is based on several authentic hadith in which النبي Muhammad (صلى الله عليه وسلم) explicitly permitted proxy الحج (الحج al-badal) for the deceased. The most well-known is the hadith of the woman from Juhaynah who asked about her mother who had vowed to perform الحج but died before fulfilling it.
The conditions for performing proxy الحج vary slightly across the schools, but the core requirements are agreed upon: the proxy (na'ib) should have already completed their own واجب الحج before performing it on someone else's behalf; the proxy should be a Muslim of sound mind; and the deceased should have been a Muslim. If the deceased had the financial and physical ability to perform الحج during their lifetime but did not, the cost of sending someone for proxy الحج should be taken from the deceased's estate before distributing the inheritance, عند جمهور العلماء. This is treated like a debt owed to Allah.
The proxy should make the intention (niyyah) at the الميقات specifically on behalf of the deceased, saying the talbiyah with the deceased's name: 'Labbayk on behalf of [name].' All the rites are performed exactly as one would for their own الحج. The reward of the الحج goes to the deceased, while the proxy also earns reward for their good deed. Scholars agree that the proxy may also perform العمرة on behalf of the deceased in the same manner.