Below is the whole doctrinal teaching on chastity contained in the Catechism of the Catholic Church.
PART THREE: LIFE IN CHRIST
SECTION TWO THE TEN COMMANDMENTS
CHAPTER TWO YOU SHALL LOVE YOUR NEIGHBOR AS YOURSELF
Article 6 THE SIXTH COMMANDMENT
II. The Vocation to Chastity
_II. The Vocation to Chastity
2337 Chastity means the successful integration of sexuality within the person and thus the inner unity of man in his bodily and spiritual being. Sexuality, in which man's belonging to the bodily and biological world is expressed, becomes personal and truly human when it is integrated into the relationship of one person to another, in the complete and lifelong mutual gift of a man and a woman.
The virtue of chastity therefore involves the integrity of the person and the integrality of the gift.
The integrity of the person
2338 The chaste person maintains the integrity of the powers of life and love placed in him. This integrity ensures the unity of the person; it is opposed to any behavior that would impair it. It tolerates neither a double life nor duplicity in speech.124
2339 Chastity includes an apprenticeship in self-mastery which is a training in human freedom. the alternative is clear: either man governs his passions and finds peace, or he lets himself be dominated by them and becomes unhappy.125 "Man's dignity therefore requires him to act out of conscious and free choice, as moved and drawn in a personal way from within, and not by blind impulses in himself or by mere external constraint. Man gains such dignity when, ridding himself of all slavery to the passions, he presses forward to his goal by freely choosing what is good and, by his diligence and skill, effectively secures for himself the means suited to this end."126
2340 Whoever wants to remain faithful to his baptismal promises and resist temptations will want to adopt the means for doing so: self-knowledge, practice of an ascesis adapted to the situations that confront him, obedience to God's commandments, exercise of the moral virtues, and fidelity to prayer. "Indeed it is through chastity that we are gathered together and led back to the unity from which we were fragmented into multiplicity."127
2341 The virtue of chastity comes under the cardinal virtue of temperance, which seeks to permeate the passions and appetites of the senses with reason.
2342 Self-mastery is a long and exacting work. One can never consider it acquired once and for all. It presupposes renewed effort at all stages of life.128 The effort required can be more intense in certain periods, such as when the personality is being formed during childhood and adolescence.
2343 Chastity has laws of growth which progress through stages marked by imperfection and too often by sin. "Man . . . day by day builds himself up through his many free decisions; and so he knows, loves, and accomplishes moral good by stages of growth."129
2344 Chastity represents an eminently personal task; it also involves a cultural effort, for there is "an interdependence between personal betterment and the improvement of society."130 Chastity presupposes respect for the rights of the person, in particular the right to receive information and an education that respect the moral and spiritual dimensions of human life.
2345 Chastity is a moral virtue. It is also a gift from God, a grace, a fruit of spiritual effort.131 The Holy Spirit enables one whom the water of Baptism has regenerated to imitate the purity of Christ.132
The integrality of the gift of self
2346 Charity is the form of all the virtues. Under its influence, chastity appears as a school of the gift of the person. Self-mastery is ordered to the gift of self. Chastity leads him who practices it to become a witness to his neighbor of God's fidelity and loving kindness.
2347 The virtue of chastity blossoms in friendship. It shows the disciple how to follow and imitate him who has chosen us as his friends,133 who has given himself totally to us and allows us to participate in his divine estate. Chastity is a promise of immortality.
Chastity is expressed notably in friendship with one's neighbor. Whether it develops between persons of the same or opposite sex, friendship represents a great good for all. It leads to spiritual communion.
The various forms of chastity
2348 All the baptized are called to chastity. the Christian has "put on Christ,"134 The model for all chastity. All Christ's faithful are called to lead a chaste life in keeping with their particular states of life. At the moment of his Baptism, the Christian is pledged to lead his affective life in chastity.
2349 "People should cultivate [chastity] in the way that is suited to their state of life. Some profess virginity or consecrated celibacy which enables them to give themselves to God alone with an undivided heart in a remarkable manner. Others live in the way prescribed for all by the moral law, whether they are married or single."135 Married people are called to live conjugal chastity; others practice chastity in continence:
There are three forms of the virtue of chastity: the first is that of spouses, the second that of widows, and the third that of virgins. We do not praise any one of them to the exclusion of the others.... This is what makes for the richness of the discipline of the Church.136
2350 Those who are engaged to marry are called to live chastity in continence. They should see in this time of testing a discovery of mutual respect, an apprenticeship in fidelity, and the hope of receiving one another from God. They should reserve for marriage the expressions of affection that belong to married love. They will help each other grow in chastity.
Offenses against chastity
2351 Lust is disordered desire for or inordinate enjoyment of sexual pleasure. Sexual pleasure is morally disordered when sought for itself, isolated from its procreative and unitive purposes.
2352 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."137 "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."138
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.
2353 Fornication is carnal union between an unmarried man and an unmarried woman. It is gravely contrary to the dignity of persons and of human sexuality which is naturally ordered to the good of spouses and the generation and education of children. Moreover, it is a grave scandal when there is corruption of the young.
2354 Pornography consists in removing real or simulated sexual acts from the intimacy of the partners, in order to display them deliberately to third parties. It offends against chastity because it perverts the conjugal act, the intimate giving of spouses to each other. It does grave injury to the dignity of its participants (actors, vendors, the public), since each one becomes an object of base pleasure and illicit profit for others. It immerses all who are involved in the illusion of a fantasy world. It is a grave offense. Civil authorities should prevent the production and distribution of pornographic materials.
2355 Prostitution does injury to the dignity of the person who engages in it, reducing the person to an instrument of sexual pleasure. the one who pays sins gravely against himself: he violates the chastity to which his Baptism pledged him and defiles his body, the temple of the Holy Spirit.139 Prostitution is a social scourge. It usually involves women, but also men, children, and adolescents (The latter two cases involve the added sin of scandal.). While it is always gravely sinful to engage in prostitution, the imputability of the offense can be attenuated by destitution, blackmail, or social pressure.
2356 Rape is the forcible violation of the sexual intimacy of another person. It does injury to justice and charity. Rape deeply wounds the respect, freedom, and physical and moral integrity to which every person has a right. It causes grave damage that can mark the victim for life. It is always an intrinsically evil act. Graver still is the rape of children committed by parents (incest) or those responsible for the education of the children entrusted to them.
Chastity and homosexuality
2357 Homosexuality refers to relations between men or between women who experience an exclusive or predominant sexual attraction toward persons of the same sex. It has taken a great variety of forms through the centuries and in different cultures. Its psychological genesis remains largely unexplained. Basing itself on Sacred Scripture, which presents homosexual acts as acts of grave depravity,140 tradition has always declared that "homosexual acts are intrinsically disordered."141 They are contrary to the natural law. They close the sexual act to the gift of life. They do not proceed from a genuine affective and sexual complementarity. Under no circumstances can they be approved.
2358 The number of men and women who have deep-seated homosexual tendencies is not negligible. This inclination, which is objectively disordered, constitutes for most of them a trial. They must be accepted with respect, compassion, and sensitivity. Every sign of unjust discrimination in their regard should be avoided. These persons are called to fulfill God's will in their lives and, if they are Christians, to unite to the sacrifice of the Lord's Cross the difficulties they may encounter from their condition.
2359 Homosexual persons are called to chastity. By the virtues of self-mastery that teach them inner freedom, at times by the support of disinterested friendship, by prayer and sacramental grace, they can and should gradually and resolutely approach Christian perfection._