It is permissible to perform Hajj on behalf of a deceased person, as the Prophet ﷺ said to a woman:
نعم حجى عنها
"Yes, perform Hajj on her behalf."
[Bukhārī: 5/116, Kitāb al-Ḥajj: Bāb al-Ḥajj wa al-Nadhr ʿan al-Mayyit wa al-Rajul Yaḥujj ʿan al-Marʾah; al-Nasāʾī: 5/116]
A person must have already performed their own obligatory Hajj before performing Hajj for someone else, as the Prophet ﷺ instructed a man:
حج عن نفسك ثم حج عن شبرمة
"(First) perform Hajj for yourself, then perform Hajj for Shubrumah."
[Sahih: Sahih Abū Dāwūd: 1596; Abū Dāwūd: 1811; Ibn Mājah: 2903; Ibn Ḥibbān: 3988; al-Dāraqutnī: 2/270; Abū Yaʿlā: 2440; Ibn Khuzaymah: 3039; Ṭabarānī al-Kabīr: 12419]
Ibn Taymiyyah: Performing Hajj on behalf of the deceased is permissible by consensus.
[Majmūʿ al-Fatāwā: 9/26]
نعم حجى عنها
"Yes, perform Hajj on her behalf."
[Bukhārī: 5/116, Kitāb al-Ḥajj: Bāb al-Ḥajj wa al-Nadhr ʿan al-Mayyit wa al-Rajul Yaḥujj ʿan al-Marʾah; al-Nasāʾī: 5/116]
Condition Before Performing Hajj for Another
A person must have already performed their own obligatory Hajj before performing Hajj for someone else, as the Prophet ﷺ instructed a man:
حج عن نفسك ثم حج عن شبرمة
"(First) perform Hajj for yourself, then perform Hajj for Shubrumah."
[Sahih: Sahih Abū Dāwūd: 1596; Abū Dāwūd: 1811; Ibn Mājah: 2903; Ibn Ḥibbān: 3988; al-Dāraqutnī: 2/270; Abū Yaʿlā: 2440; Ibn Khuzaymah: 3039; Ṭabarānī al-Kabīr: 12419]
Ibn Taymiyyah: Performing Hajj on behalf of the deceased is permissible by consensus.
[Majmūʿ al-Fatāwā: 9/26]