Every person can do good deeds on behalf of others especially one’s parents. In such a case, not only will the reward of that deed go to the one that has been gifted the good deed, but the person doing the good deed will also be rewarded the same reward, if not more.
In order to answer your question, we first need to distinguish between different parents with different amounts of faith, then speak of what role their children play in doing good towards them, and finally about the difference between them being alive or not.
Doing good to parents is one of Islam’s guidelines that has been emphasized a lot, to the extent that Allah (swt) has ordered us to thank Him and our parents in the same sentence (signifying the importance and respect of parents) without any seperation. There are many verses in the Quran that ask us to be good with them and to ask Allah (swt) for their forgiveness.
Of course, there is a difference between parents who are righteous and pious who have played an important role in their children’s growth and development (religionwise), and those who aren’t in the straight path.
Turning over to society a well-raised child that one has grown through good training can be one of the great successes of an individual bringing him/her prosperity. In these cases, anything righteous and good that the child does after growing up, will also be taken into consideration for his/her parents as well, to the extent that even after the parents’ death, the child’s good deeds will continue to be recorded in their deeds as well, along with all the possessions and knowledge (eg. books written) that they have left behind to be spent in good ways. Therefore, there are three things that can do us good even after our death; righteous children, possessions that we have spent in the way of Allah (swt) (like building a hospital or school) and good knowledge that we have left behind that benefit others.
It has been said in a hadith by the Prophet (pbuh) that: “Whenever a person reads even one verse of the Holy Quran, two luxurious garments are granted to that person’s parents and it is said to them that these are a gift to you as a result of teaching him the Quran.” As you can see, even if one does a good deed without the intention of gifting its reward to his/her parents, Allah (swt) still rewards the parents as a means of thanks and in return for their efforts in raising such a child.
Now if one’s parents weren’t on the right path and not only didn’t have any role in their children’s faith, but would also sometimes get in the way of their faith, yet this child(ren) still like to help them by gifting them the reward of some of their good deeds, these parents can be of one of two cases:
1- In addition to them being disbelievers, they were enemies of the believers and would get in the way of the spreading of the truth: In this case, one needs to separate his/her way from their’s. How Prophet Ibrahim acted towards his father (or uncle) is good proof for our claim. It had been a long time since his Excellency had asked Allah (swt) for his father’s forgiveness, but once he became certain that his father was an enemy of God, he repudiated him and his actions.
Therefore, if one’s parents are an enemy of Allah (swt), doing anything they can to stand in His way, their children’s efforts to save them from the Hellfire are ineffective. Of course, some hadiths imply that their efforts aren’t totally ineffective and that these efforts cause the parents’ chastisement to decrease a bit.
2- Although they weren’t disbelievers, nevertheless, they held no enmity towards the believers and lived along with them in peace and harmony. This is the case with most disbelievers; they usually aren’t in straight conflict with the believers, preventing their children from becoming Muslim at the most. The Quran asks those with such parents not to obey them regarding converting to Islam or not, but at the same time asks them to be nice and have appropriate behavior towards them. Mu’ammar ibn Khalid says: “I said to Imam Ridha (as) that my parents weren’t on the straight path, should I pray for them?” His Excellency answered: “Although they weren’t on the straight path, yet pray for them and give charity on their behalf, and if they are alive, be nice with them, the Holy Prophet (pbuh) has said: “My lord has sent me for mercy and kindness, not for breaking relationships and discontentment.”.” Hence, it is okay to ask for the forgiveness of such parents and do good deeds on their behalves. Imam Baqir (as) has counted praying for one’s parents as one of the five kinds of prayer that go straight to Allah (swt) without any interference and without any need of a mediator. Therefore, there is hope that Allah (swt) will forgive the disbelieving parents of a believer who weren’t in the right conditions and didn’t have enough information for converting to Islam, as a result of the good deeds of their child(ren).
As for the question that asks if it is possible to do good deeds on the behalf of others (including one’s parents), one must say that there is no difference between the dead and those alive, and that the only limitations of “gifting” the rewards and blessings of a good deed are those pertaining to good deeds that are wajib. One can't do the wajib acts of others on their behalf while they are alive. For instance, we can't perform the wajib prayers and fasts that another has missed while he/she is alive. It is only after that person’s death that such a thing becomes possible.
But when it comes to mustahabb acts, there are numerous hadiths that allow us to gift the rewards and blessings of such acts to others in addition to our parents, or share these rewards.
In a hadith by Imam Sadiq (as), he says: “The Hajj that one does on behalf of others, causes him/her to also be forgiven along with his father, mother, son, daughter, brother, sister, uncle and aunt (from the mother and father’s side) and the reason behind this matter is the never-ending grace and mercy of Allah (swt)”, and that is why pilgrims of Makkah who go to Hajj usually perform mustahabb tawafs (circulation around the Kabah) on the behalf of their friends and relatives, regardless of whether they are dead or alive.
There is also another hadith that explicitly expresses the fact that it is possible to perform good acts on the behalf of one’s parents even when they are alive. Imam Sadiq (as) says: “What can stop people from doing good to their parents (meaning that there is nothing that can stop them from doing good to their parents), regardless of them (parents) being alive or dead? They can perform (mustahabb) prayers on their behalves, give charity instead of them, perform Hajj on their behalves and fast and gift its blessings to them. If they do so, the blessings and rewards of these acts will be recorded for their parents and Allah (swt) will also reward the children for doing good to their parents and observing silatul-rahem (bonds of relationship), and in addition to the reward of the good deed itself, He will also bestow other blessings on the children as well.
Conclusion: The answer to your question is that yes, you can do good deeds on behalf of your parents or anyone else, and this act will benefit them even though they haven’t done anything, and that is because of Allah’s never-ending grace and mercy.
 Luqman:14 (ان اشکر لی و لوالدیک)
 Ibrahim:41, Nuh:28, Shu’ara’:86 and… .
 Muhammad ibnil-Hasan Hurr Al-Ameli, Wasa’elul-Shia, Aalul-Bayt Institute, Qum, 1409 (lunar), vol. 21, pg. 22, hadith 27296.
 Muhammad Baqir Majlisi, Biharul-Anwar, Wafa’,
 Wasa’elul-Shia, vol. 6, pg. 179, hadith 7674.
 There is a difference of opinion on whether Prophet Ibrahim’s true father is meant by “ابیه” that has been mentioned in the verse, or his uncle. (Some Sunni commentators believe that Azar was Prophet Ibrahim’s true father, while all Shia commentators believe that he wasn’t his father, some know him as his step-father and others see him as his uncle. See: Tafsir Nemouneh, vol. 5, pg. 304.) But in both cases, the conclusion drawn from this verse is correct and proves our claim.
 Mumtahinah:4, Ibrahim:41.
 Muhaddith Nouri, Mustadrakul-Wasael, Aalul-Bayt Institute, Qum, 1408 (lunar), vol. 2, pg. 111, hadith 1567.
 Ankabut:8, Luqman:15.
 Wasa’elul-Shia, vol. 21, pg. 490, hadith 27667.
 Ibid, vol. 7, pg. 116, hadith 8892.
 Ibid, vol. 11, pg. 165, hadith 14535.
 Ibid, vol. 8, pg. 276, hadith 10647.