Judaism and masturbation

The prohibition of extracting semen in vain (in Hebrew: הוצאת זרע לבטלה) is (according to Orthodox Judaism) a Biblical prohibition   derived from (Genesis 38:7), this is explained in the Midrash and Talmud. (A Rabbinical prohibition is one that is not found in the Torah by way of biblical exegesis - a Biblical prohibition is one that is.) The prohibition forbids a male from intentional wasteful spilling of his semen. Unintentional wasting of seed is also a (lesser) sin according to the Oral Torah.

Biblical sources
A superficial reading of the Hebrew Bible seems to indicate that there is no commandment phrased as a prohibition against masturbation, however, many Rabbi have held that the prohibition can clearly be seen upon further analysis.

states that any male who emits semen is considered ritually impure - whether the emission came through masturbation, nocturnal emission, or sex between married heterosexual partners. The traditional rabbinical interpretation and simple reading of Leviticus 15 indicates that it applies to all sperm flows, including sperm flows due to masturbation. Other than this ritual impurity, no consequences or punishments are specified in those verses.

The Biblical story of Onan is interpreted by many commentators as a source for prohibiting ejaculation outside a woman's body, including masturbation. In the story, Onan did not want to impregnate his wife (either because, this being a Levirate marriage, the resulting child would be considered to belong to Onan's brother Er rather than Onan, or because he didn't want to ruin her beauty with pregnancy, or because he didn't want to bear the effort of raising children, among other reasons), so when they had sex Onan performed coitus interruptus and caused his semen to spill on the ground. Onan was slain by God, which was deemed retribution for being "evil in the sight of the Lord". The Talmud explains that his sin was ejaculating outside the context of marriage. Some say that part of his sin was denying a child to Er (which would have no implications for masturbation).

The halakhic prohibition on masturbation
The Babylonian Talmud, Niddah 13a-b, is the longest and most comprehensive discussion of the topic. This states that if a man frequently touches his penis with his hand (in order to check for ritually impure emission), his hand "ought to be cut off". It prohibits "emitting seed in vain", a term generally (but not only) referring to masturbation. The same passage likens the act to murder and idolatry, and also prohibits a man from intentionally arousing himself:

"With regard to any hand that is diligent to examine bodily emissions to ascertain ritual impurity, among women such a hand is praiseworthy. But among men such a hand should be severed [as this action is apt to lead to a seminal emission for naught] [...]

Rabbi Eliezer says: With regard to anyone who holds his penis and urinates, it is considered as though he is bringing a flood to the world [...]

Rabbi Yoḥanan says: Anyone who emits semen for naught is liable to receive the punishment of death at the hand of Heaven, as it is stated with regard to Onan [...]

Rabbi Yitzḥak and Rabbi Ami say: One who emits semen for naught is considered as though he sheds blood [...]

Rav Asi says: It is considered as though he worships idols [...]

Rav says: One who intentionally causes himself an erection shall be ostracized."

When examined critically, Niddah 13a-b may be separated into several strata. The discussion of the non-procreative emission of semen came in the redactorial strata; the tannaitic sources make no mention and only discuss arousal.

The Shulchan Aruch and Kitzur Shulchan Aruch state that wasting sperm is considered to be a sin greater than any sin in the Torah. The commentary Beit Shmuel states that this is not literal, but rather serves to frighten man into avoiding the sin. However, the Zohar cites one opinion which says that a person can never repent for wasting sperm, and another that says it requires "great/powerful repentance" (lit. "multitudinous repentance" - תשובה רבה). The Arizal taught that one is obligated to fast eighty-four times to repent for the discharging of semen in vain. The Tanya contends that, in current times, one can give to charity in place of fasting. Rabbi Nachman of Breslov claimed that masturbation leads to depression, and that the effects of impure ejaculation can only be nullified through the recitation of the Tikkun Haklali.

According to Sefer haChinuch, one of the reasons for the prohibition on male homosexual sex is that sperm is destroyed for no constructive purpose.

Female masturbation
Female masturbation is not explicitly prohibited, but authorities such as Rabbi Moshe Feinstein consider female masturbation as necessarily involving forbidden "impure thoughts". However, Hida and Rabbi Tzvi Pesach Frank disagreed. Ben Ish Chai states that it is wrong because it creates evil forces (Kelipos). In any case, female masturbation does not carry the severity of male masturbation, because it does not involve the release of seed.

Situations in which halakha may permit "wasting" sperm
There is disagreement among the poskim (decisors of Jewish law) whether masturbation is an acceptable way of procuring semen for artificial insemination or in vitro fertilisation.

Some poskim rule that it is possible to masturbate to avoid arayot (forbidden relationships). Sefer Hasidim states that if a man's sexual desire is so great that he is afraid of committing a worse sin, then he is allowed to masturbate in order to avoid a worse sin, but must then perform penance by fasting or sitting in ice water.

Married couples
Even if a wife is unable to become pregnant (e.g. infertile, old, or currently pregnant or nursing), sexual relations between a married couple are not only permitted, but required within the framework of the commandment of onah. This is despite the fact that the sperm will be "wasted" in the sense of not causing pregnancy.

Rabbinic authorities have in certain instances permitted intentional extra-vaginal ejaculation in tandem with a man's wife.

Rabbi Meir recommended a man perform coitus interruptus (דש מבפנים וזורה מבחוץ) with his wife while she is pregnant or nursing, for health reasons. For similar reasons, Rabbi Eliezer recommended coitus interruptus for a duration of 24 months after birth.

Tosafot cites the opinion of Rabbi Yitzchak (Isaac ben Samuel) who permitted an occasional exterior ejaculation with one's wife on the condition that one does not accustom himself to always doing so, as this is not considered comparable to Onan, who wished to avoid impregnating Tamar entirely. This opinion is accepted as normative by Rabbeinu Asher, Arba'ah Turim, Sefer HaAguddah, Maharsha, Bayit Chadash, Eliyah Rabbah, and some other authorities.

A more explicit permissive stance is that of the tosafist rabbi Isaiah di Trani the Elder:

"What was the (forbidden) action of Er and Onan that the Torah prohibits? that committed with the intent of not diminishing her beauty (due to pregnancy) and he doesn't desire to fulfill the mitzvah of procreation (פרו ורבו) with her. But if his intent.. is for his inclination and to satisfy his desire and his intent is not to avoid impregnating her, it is permitted, ..he whose intent is to fulfill the desire of his inclination does not transgress as "all that a man wants to do with his wife he may do" - and this isn't called "wasting his seed"."

Rabbi Isaiah the Elder's view is likewise echoed by his descendant, rabbi Isaiah di Trani the Younger.

Rabbi Eleazar of Worms permits any activity with one's wife necessary to "quiet (lit. seat)" his desire.

Non-Orthodox movements
Reform and Reconstructionist rabbis have decided on more liberal conclusions. Reconstructionist Rabbi Alexis Roberts maintains that masturbation is "harmless, natural and healthy. It may provide release and pleasure, as well as self-knowledge that is useful for pleasurable sex with a partner. It may make it easier for young people to have sexual release in the years when they are too young for a mature, committed, loving relationship." Reform Rabbi Jonathan Stein, in a proposed schema for normative Reform evaluation of different sexual activities, proposed that masturbation be considered "mutar", a term generally translated as "permissible", but which he renders as "tolerable". Rabbi Walter Jacob, writing on behalf of the Reform responsa committee, asserts, "Although the statements of tradition are very clear, we would take a different view of masturbation, in the light of current psychological thought. Masturbation should be discouraged, but we would not consider it harmful or sinful."

Conservative Rabbi Ariel Wolpe, while conceding that the Talmudic rabbis do not take a permissive view with regards to masturbation, argues that possible health and relationship benefits could justify the act. She points out that masturbation can lower risk for prostate cancer, offers stress relief, can lead to healthier sexual relationships. Considering Maimonides, “maintain physical health and vigor so that the soul may be upright and in condition to know God”, she discusses the emphasis Jewish tradition places on health and uses it as a justification for masturbation if it leads to greater bodily or relationship health.

Jacob Milgrom stated that the rabbis condemned masturbation, and that "it is their enactment, not that of Scripture." Conservative rabbi Elliot Dorff has noted that Maimonides states that the Tanakh does not explicitly prohibit masturbation.