The Compendium of the Social Doctrine of the Church by the Pontifical Council for Justice and Peace at the Vatican Has This to Say About the Death Penalty:

#405. The Church sees as a sign of hope “a growing public opposition to the death penalty, even when such a penalty is seen as a kind of ‘legitimate defense’ on the part of society. Modern society in fact has the means of effectively suppressing crime by rendering criminals harmless without definitively denying them the chance to reform.” 833 Whereas, presuming the full ascertainment of the identity and responsibility of the guilty party, the traditional teaching of the Church does not exclude the death penalty “when this is the only practicable way to defend the lives of human beings effectively against the aggressor.” 834 Bloodless methods of deterrence and punishment are preferred as “they better correspond to the concrete conditions of the common good and are more in conformity to the dignity of the human person.” 835 The growing number of countries adopting provisions to abolish the death penalty or suspend its application is also proof of the fact that cases in which it is absolutely necessary to execute the offender “are very rare, if not practically non-existent.”836 The growing aversion of public opinion towards the death penalty and the various provisions aimed at abolishing it or suspending its application constitute visible manifestations of a heightened moral awareness.
833 John Paul ii, Encyclical Letter Evangelium Vitae, 27: AAS 87 (1995), 432
834 Catechism of the Catholic Church, 2267
835 ibid
836 John Paul ii, Encyclical Letter Evangelium Vitae, 56: AAS 87 (1995), 464; cf. also John Paul II, Message for the 2001 World Day of Peace, 19” AAS 93 (2001), 244 where recourse to the death penalty is described as “unnecessary.”