In a few words and very clearly:
796. What are indulgences? - Indulgences are the remission of the temporal punishment due for our sins, already forgiven as to guilt, a remission granted by the Church outside the sacrament of Penance.
797. From whom has the Church received the power to assign indulgences? - The Church has received from Jesus Christ the faculty to grant indulgences.
798. In what way does the Church forgive us the temporal punishment for by means of indulgences? - The Church forgives us temporal punishment by means of indulgences, applying to us the superabundant satisfactions of Jesus Christ, of Mary Most Holy and of the Saints, which form what is called the treasure of the Church.
799. Who has the power to grant indulgences? - The power to grant indulgences is vested solely in the Pope in the whole Church and in the Bishop in his diocese, according to the faculty granted to him by the Pope.
800. How many species are indulgences? - Indulgences are of two kinds: plenary and partial.
801. What is plenary indulgence? - Plenary indulgence is that which forgives all the temporal punishment due for sins. For this reason, if one were to die after gaining it, he would go straight to heaven, without passing through purgatory.
802. What is partial indulgence? - Partial indulgence is that which forgives only a part of the temporal punishment due for sins.
803. What does the Church intend by granting indulgences? - By granting indulgences, the Church intends to help the incapacity we have to expiate in this world all temporal punishment, making us achieve, through works of piety and Christian charity, what in the first centuries she tried to do with the rigor of the penitential canons.
804. What is meant by indulgence of one hundred days, seven years, and other similar ones? - By indulgence of one hundred days, seven years, etc., is understood the remission of as much temporal punishment as would be discounted by one hundred days or seven years of the penance formerly established by the Church.
805. What case are we to make of indulgences? - We should make a very great use of indulgences, because with them we satisfy the justice of God and more quickly and easily attain possession of heaven.
806. What is required to earn indulgences? - To gain indulgences, one must be in a state of grace (at least in the last work to be accomplished) and pure, even in venial faults for which we wish to be forgiven; 2nd , fulfillment of the prescribed works; 3rd , intention to gain them; 4th , be a subject of the one who grants them.From the Catechism of St. Pius X
With more words and more modern, the catechism of St. John Paul II says the same thing:
1471 The doctrine and practice of indulgences in the Church are closely linked to the effects of the sacrament of Penance.
What are indulgences
"An indulgence is the remission before God of the temporal punishment for sins, already forgiven as to guilt, which a faithful who is willing and fulfills certain conditions obtains through the mediation of the Church, which, as the administrator of redemption, distributes and applies with authority the treasure of the satisfactions of Christ and of the saints" (Paul VI, Const. ap. Indulgentiarum doctrina, norms 1).
"An indulgence is partial or plenary according to whether it frees from the temporal punishment due for sins in part or in full" (Indulgentiarum doctrina, norms 2). "Every member of the faithful can gain for himself or apply for the deceased, by way of suffrage, both partial and plenary indulgences" (CCC can 994).
The penalties of sin
1472 To understand this doctrine and practice of the Church, it is necessary to remember that sin has a twofold consequence. Grave sin deprives us of communion with God and thus makes us incapable of eternal life, the deprivation of which is called the "eternal punishment" of sin. On the other hand, all sin, even venial sin, entails disordered attachment to creatures, which must be purified, either here below or after death, in the state called Purgatory. This purification frees from what is called the "temporal punishment" of sin. These two penalties are not to be conceived of as a kind of vengeance, inflicted by God from without, but as something that springs from the very nature of sin. A conversion that proceeds from fervent charity can lead to the total purification of the sinner, so that no penalty would remain (cf. Council of Trent: DS 1712-13; 1820).
1473 Forgiveness of sin and restoration of communion with God entail the remission of the eternal penalties of sin. But the temporal penalties of sin remain. The Christian must strive, patiently enduring sufferings and trials of every kind and, when the day comes, serenely facing death, to accept as a grace these temporal penalties of sin; he must apply himself, both by works of mercy and charity and by prayer and the various practices of penance, to put off completely the "old man" and to put on the "new man" (cf. Eph. 4:24).
In the communion of saints
1474 The Christian who wants to purify himself of his sin and sanctify himself with the help of God's grace does not find himself alone. "The life of each of God's children is linked in an admirable way, in Christ and through Christ, with the life of all other Christian brothers and sisters, in the supernatural unity of the Mystical Body of Christ, as in a mystical person" (Paul VI, Const. ap. Indulgentiarum doctrina, 5).
1475 In the communion of saints, therefore, "there exists among the faithful, both among those who are already blessed and among those who atone in purgatory or who are still on pilgrimage on earth, a constant bond of love and an abundant exchange of all good things" (ibid.). In this admirable exchange, the holiness of one benefits the others, beyond the harm that the sin of one may have caused to the others. Thus, recourse to the communion of saints allows the contrite sinner to be purified before and more effectively from the pains of sin.
1476 These spiritual goods of the communion of saints we also call the treasure of the Church, "which is not a sum of goods, as are the material riches accumulated in the course of the centuries, but is the infinite and inexhaustible value before God of the atonements and merits of Christ our Lord, offered so that humanity might be freed from sin and come into communion with the Father. In Christ our Redeemer alone are the satisfactions and merits of his redemption found in abundance" (Indulgentiarum doctrina, 5).
1477 "Also belonging to this treasure is the truly immense, immeasurable and ever new price which the prayers and good works of the Blessed Virgin Mary and of all the saints, who sanctified themselves by the grace of Christ, following in his footsteps, and accomplished a work pleasing to the Father, so that, working for their own salvation, they likewise cooperated in the salvation of their brethren in the unity of the Mystical Body" (Indulgentiarum doctrina, 5).
God's indulgence is obtained through the Church
1478 Indulgences are obtained by the Church which, by virtue of the power of binding and loosing granted to her by Christ Jesus, intervenes on behalf of a Christian and opens to him the treasury of the merits of Christ and the saints in order to obtain from the Father of mercy the remission of the temporal penalties due for his sins. For this reason the Church not only wants to come to the aid of this Christian, but also to impel him to works of piety, penance and charity (cf. Indulgentiarum doctrina, 8; Council of Trent: DS 1835).
1479 Since the faithful departed on the way of purification are also members of the same communion of saints, we can help them, among other ways, by obtaining indulgences for them, so that they may be freed from the temporal penalties due for their sins.St. John Paul II, Catechism of the Catholic Church, 1992.