The Catechism of the Catholic Church teaches:
“All who die in God’s grace and friendship, but still imperfectly purified, are indeed assured of their eternal salvation; but after death they undergo purification, so as to achieve the holiness necessary to enter the joy of heaven.” (CCC 1030)“This teaching is also based on the practice of prayer for the dead, already mentioned in Sacred Scripture: ‘Therefore Judas Maccabeus] made atonement for the dead, that they might be delivered from their sin.’” (CCC 1032)“From the beginning, the Church has honored the memory of the dead and offered prayers in suffrage for them, above all the Eucharistic sacrifice, so that, thus purified, they may attain the beatific vision of God. The Church also commends almsgiving, indulgences, and works of penance undertaken on behalf of the dead:“Let us help and commemorate them. If Job’s sons were purified by their father’s sacrifice, why would we doubt that our offerings for the dead bring them some consolation? Let us not hesitate to help those who have died and to offer our prayers for them.” (CCC 1032)
EWTN