The Lord himself affirms that Baptism is necessary for salvation (Cf. Jn 3:5). He also commands his disciples to proclaim the Gospel to all nations and to baptize them (Cf. Mt 28:19-20; cf. Council of Trent (1547) DSDenzinger-Schönmetzer, Enchiridion Symbolorum, definitionum et declarationum de rebus fidei et morum 1618; LGLumen gentium 14; AGAd gentes 5). Baptism is necessary for salvation for those to whom the Gospel has been proclaimed and who have had the possibility of asking for this sacrament (Cf. Mk 16:16). The Church does not know of any means other than Baptism that assures entry into eternal beatitude; this is why she takes care not to neglect the mission she has received from the Lord to see that all who can be baptized are "reborn of water and the Spirit." God has bound salvation to the sacrament of Baptism, but he himself is not bound by his sacraments.
CCC 1261
The Church has always held the firm conviction that those who suffer death for the sake of the faith without having received Baptism are baptized by their death for and with Christ. This Baptism of blood, like the desire for Baptism, brings about the fruits of Baptism without being a sacrament.
For catechumens who die before their Baptism, their explicit desire to receive it, together with repentance for their sins, and charity, assures them the salvation that they were not able to receive through the sacrament.
"Since Christ died for all, and since all men are in fact called to one and the same destiny, which is divine, we must hold that the Holy Spirit offers to all the possibility of being made partakers, in a way known to God, of the Paschal mystery." (GSGaudium et spes 22 # 5; cf. LGLumen gentium 16; AGAd gentes 7) Every man who is ignorant of the Gospel of Christ and of his Church, but seeks the truth and does the will of God in accordance with his understanding of it, can be saved. It may be supposed that such persons would have desired Baptism explicitly if they had known its necessity.
As regards children who have died without Baptism, the Church can only entrust them to the mercy of God, as she does in her funeral rites for them. Indeed, the great mercy of God who desires that all men should be saved, and Jesus' tenderness toward children which caused him to say: "Let the children come to me, do not hinder them," (Mk 10 14; cf. 1 Tim 2:4) allow us to hope that there is a way of salvation for children who have died without Baptism. All the more urgent is the Church's call not to prevent little children coming to Christ through the gift of holy Baptism.
The different effects of Baptism are signified by the perceptible elements of the sacramental rite. Immersion in water symbolizes not only death and purification, but also regeneration and renewal. Thus the two principal effects are purification from sins and new birth in the Holy Spirit (Cf. Acts 2:38; Jn 3:5).
For the forgiveness of sins...
By Baptism all sins are forgiven, original sin and all personal sins, as well as all punishment for sin (Cf. Council of Florence (1439): DSDenzinger-Schönmetzer, Enchiridion Symbolorum, definitionum et declarationum de rebus fidei et morum 1316). In those who have been reborn nothing remains that would impede their entry into the Kingdom of God, neither Adam's sin, nor personal sin, nor the consequences of sin, the gravest of which is separation from God.
Yet certain temporal consequences of sin remain in the baptized, such as suffering, illness, death, and such frailties inherent in life as weaknesses of character, and so on, as well as an inclination to sin that Tradition calls concupiscence, or metaphorically, "the tinder for sin" (fomes peccati); since concupiscence "is left for us to wrestle with, it cannot harm those who do not consent but manfully resist it by the grace of Jesus Christ." (Council of Trent (1546): DSDenzinger-Schönmetzer, Enchiridion Symbolorum, definitionum et declarationum de rebus fidei et morum 1515) Indeed, "an athlete is not crowned unless he competes according to the rules." (2 Tim 2:5)
"A new creature"
Baptism not only purifies from all sins, but also makes the neophyte "a new creature," an adopted son of God, who has become a "partaker of the divine nature," (2 Cor 5:17; 2 Pet 1:4; cf. Gal 4:5-7) member of Christ and coheir with him (Cf. 1 Cor 6:15; 12:27; Rom 8:17), and a temple of the Holy Spirit (Cf. 1 Cor 6:19).