General Remarks On Indulgences from the Apostolic Penitentiary
1. This is how an indulgence is defined in the Code of Canon Law (can. 992) and in the Catechism of the Catholic Church (n. 1471): "An indulgence is a remission before God of the temporal punishment due to sins whose guilt has already been forgiven, which the faithful Christian who is duly disposed gains under certain prescribed conditions through the action of the Church which, as the minister of redemption, dispenses and applies with authority the treasury of the satisfactions of Christ and the saints".
2. In general, the gaining of indulgences requires certain prescribed conditions (below, nn. 3, 4), and the performance of certain prescribed works .
3. To gain indulgences, whether plenary or partial, it is necessary that the faithful be in the state of grace at least at the time the indulgenced work is completed.
4. A plenary indulgence can be gained only once a day. In order to obtain it, the faithful must, in addition to being in the state of grace:
— have the interior disposition of complete detachment from sin, even venial sin;
— have sacramentally confessed their sins;
— receive the Holy Eucharist (it is certainly better to receive it while participating in Holy Mass, but for the indulgence only Holy Communion is required);
— pray for the intentions of the Supreme Pontiff.
5. It is appropriate, but not necessary, that the sacramental Confession and especially Holy Communion and the prayer for the Pope's intentions take place on the same day that the indulgenced work is performed; but it is sufficient that these sacred rites and prayers be carried out within several days (about 20) before or after the indulgenced act. Prayer for the Pope's intentions is left to the choice of the faithful, but an "Our Father" and a "Hail Mary" are suggested. One sacramental Confession suffices for several plenary indulgences, but a separate Holy Communion and a separate prayer for the Holy Father's intentions are required for each plenary indulgence.
6. For the sake of those legitimately impeded, confessors can commute both the work prescribed and the conditions required (except, obviously, detachment from even venial sin).
7. Indulgences can always be applied either to oneself or to the souls of the deceased, but they cannot be applied to other persons living on earth.
Read more here.