Q. 1 What does the Catholic Church teach about masturbation?
A. 1 The Catholic Church teaches through its Catechism that:
"By masturbation is to be understood the deliberate stimulation of the genital organs in order to derive sexual pleasure. "Both the Magisterium of the Church, in the course of a constant tradition, and the moral sense of the faithful have been in no doubt and have firmly maintained that masturbation is an intrinsically and gravely disordered action." [CDF, Persona humana 9] "The deliberate use of the sexual faculty, for whatever reason, outside of marriage is essentially contrary to its purpose." For here sexual pleasure is sought outside of "the sexual relationship which is demanded by the moral order and in which the total meaning of mutual self-giving and human procreation in the context of true love is achieved." [CDF, Persona humana 9]
To form an equitable judgment about the subjects' moral responsibility and to guide pastoral action, one must take into account the affective immaturity, force of acquired habit, conditions of anxiety, or other psychological or social factors that lessen or even extenuate moral culpability."  (C.C.C. # 2352)
"Imputability and responsibility for an action can be diminished or even nullified by ignorance, inadvertence, duress, fear, habit, inordinate attachments, and other psychological or social factors." (C.C.C. # 1735)
Q. 2 Does this mean that it is a sin to mastubate?
A. 2 In simple terms, yes, it is a sin under normal circumstances to masturbate. By "normal circumstances," it is meant that such act does not appose any of the conditions as mentioned in C.C.C. # 1735 above. Masturbation is a self-centered sexual desire that opposes the spiritual law of mutual self-giving as found in the Sacrament of Marriage of the purpose of human reproduction in the context of true love as ordained by God.
Masturbation is a sin that must be confessed in the Sacrament of Reconciliation.