According to Catholicism, what is the purpose of praying for the dead? What is the purpose of praying for the dead according to Catholicism?
Those on earth do not know with certainty whether one is in hell, purgatory, or heaven—unless the Church has canonized the faithfully departed as a saint, in which case one is certain he or she is in heaven. Thus, Catholics pray for departed souls in the case they might be in purgatory:


  …the Catholic Church, instructed by the Holy Ghost, has, from the Sacred Writings and the ancient tradition of the Fathers, taught, in sacred Councils, and very recently in this œcumenical Synod [i.e., the Council of Trent], that there is a Purgatory, and that the souls there detained are helped by the suffrages [intercessions] of the faithful, but principally by the acceptable sacrifice of the altar…


Holy Mass and the prayers of the faithful help shorten the holy souls' time and sufferings in purgatory.

Catholics' prayers are of no avail for the damned souls, as those souls are damned for all eternity and can never enjoy the Beatific Vision: "Those (the rejected) will receive a perpetual punishment with the devil." (4th Lateran Council, 1215).