Chastity and Repentance

Masturbation in Islam: Its Ruling, Repentance, and How to Quit

All praise is due to Allah, Lord of the worlds, and peace and blessings be upon our Prophet Muhammad, his family, and all his companions.

Masturbation is an issue about which many people ask. Some Muslims fall into it and then find it difficult to stop, or they become overwhelmed by despair and shame. Its ruling must be explained clearly without minimizing the sin, while the person struggling with it should be treated with mercy, without exposure or humiliation. A believer combines fear of sin, hope in Allah's forgiveness, and serious use of the means that protect chastity.

This article explains the Islamic ruling and its evidence, distinguishes a deliberate act from involuntary thoughts and wet dreams, presents practical steps for repentance and quitting, and then clarifies the most important rulings of purification and fasting related to this issue.

What Is Meant by Masturbation?
Article Section

What Is Meant by Masturbation?

It means that a person deliberately stimulates himself or herself in pursuit of sexual pleasure or ejaculation outside the permissible means. The ruling discussed here applies to both men and women.

This does not include a wet dream, because it occurs during sleep without a person's choice, nor does it include a passing thought that a person dislikes and does not pursue. Sexual desire itself is not a sin; a servant is accountable for what he or she deliberately says or does that is prohibited.

The Ruling on Masturbation and Its Evidence
Article Section

The Ruling on Masturbation and Its Evidence

The stronger view indicated by the Islamic texts, and the view of the majority of scholars, is that masturbation is prohibited for both men and women.

Allah Most High says:

{وَالَّذِينَ هُمْ لِفُرُوجِهِمْ حَافِظُونَ * إِلَّا عَلَى أَزْوَاجِهِمْ أَوْ مَا مَلَكَتْ أَيْمَانُهُمْ فَإِنَّهُمْ غَيْرُ مَلُومِينَ * فَمَنِ ابْتَغَى وَرَاءَ ذَلِكَ فَأُولَئِكَ هُمُ الْعَادُونَ} [al-Mu'minun: 5-7].

Meaning: {And those who guard their private parts, except from their spouses or those whom their right hands possess, for then they are free from blame. But whoever seeks beyond that, then those are the transgressors.}

Allah praised the believers for guarding their private parts, excluded the permissible means, and then described those who seek sexual fulfillment beyond that as transgressors.

Abdullah ibn Masud, may Allah be pleased with him, reported that the Messenger of Allah, peace and blessings be upon him, said to us:

"يَا مَعْشَرَ الشَّبَابِ، مَنِ اسْتَطَاعَ الْبَاءَةَ فَلْيَتَزَوَّجْ؛ فَإِنَّهُ أَغَضُّ لِلْبَصَرِ، وَأَحْصَنُ لِلْفَرْجِ، وَمَنْ لَمْ يَسْتَطِعْ فَعَلَيْهِ بِالصَّوْمِ؛ فَإِنَّهُ لَهُ وِجَاءٌ".

Meaning: "O young people, whoever among you is able to marry should marry, for it is more effective in lowering the gaze and guarding chastity. Whoever is unable to do so should fast, for it will be a restraint for him."

Agreed upon.

The Prophet, peace and blessings be upon him, directed whoever is able to marry and directed whoever is unable to fast. He did not direct him to masturbation. This indicates that when marriage is not possible, the path to chastity is fasting together with lowering the gaze, striving against the self, and using the other permissible means.

Masturbation should not be called zina in the technical legal sense that entails the prescribed punishment for zina; each has its own ruling. It is nevertheless a prohibited act from which repentance is required. Its seriousness increases when it is accompanied by viewing forbidden material, occurs during the daytime in Ramadan, causes prayers or rights to be neglected, or is persistently committed without repentance.

Lowering the Gaze and Closing the Doors to Temptation
Article Section

Lowering the Gaze and Closing the Doors to Temptation

Allah Most High says:

{قُلْ لِلْمُؤْمِنِينَ يَغُضُّوا مِنْ أَبْصَارِهِمْ وَيَحْفَظُوا فُرُوجَهُمْ ذَلِكَ أَزْكَى لَهُمْ إِنَّ اللَّهَ خَبِيرٌ بِمَا يَصْنَعُونَ} [al-Nur: 30].

Meaning: {Tell the believing men to lower their gaze and guard their private parts. That is purer for them. Indeed, Allah is fully aware of what they do.}

Allah then commanded the believing women to lower their gaze and guard their private parts. Many instances of weakness begin with an image, a video, a conversation, or aimless browsing, then move from looking to continued engagement and action. Whoever truly wants to stop should begin by closing the first doors rather than trying to resist desire only after it has intensified.

If the habit is connected to viewing prohibited images or videos, both matters should be treated together. Keeping the triggers while trying to stop the act makes relapse more likely. The article Repenting from Forbidden Content may also be helpful.

The Difference Between Thoughts, Wet Dreams, and Deliberate Action
Article Section

The Difference Between Thoughts, Wet Dreams, and Deliberate Action

Abu Hurayrah, may Allah be pleased with him, reported that the Prophet, peace and blessings be upon him, said:

"إِنَّ اللَّهَ تَجَاوَزَ عَنْ أُمَّتِي مَا حَدَّثَتْ بِهِ أَنْفُسَهَا، مَا لَمْ تَعْمَلْ أَوْ تَتَكَلَّمْ".

Meaning: "Allah has pardoned my Ummah for what occurs within themselves, so long as they do not act upon it or speak of it."

Agreed upon.

The mere occurrence of an involuntary thought is not a sin as long as the person does not deliberately summon it, continue dwelling on it, or act upon it. The person should turn away from it, seek refuge with Allah, and move to a beneficial activity without obsessively examining himself or herself.

A wet dream likewise carries no sin because it occurs without choice. If a person wakes and finds semen, ghusl is required. If the person remembers a dream but finds no discharge, ghusl is not required.

Masturbation, however, is a deliberate act, so it must be abandoned and repented from.

How Is Sincere Repentance from Masturbation Made?
Article Section

How Is Sincere Repentance from Masturbation Made?

Sincere repentance is fulfilled through the following:

  1. Being sincere to Allah by leaving it out of reverence for His command and hope for His forgiveness.
  2. Stopping immediately, without waiting for a new day or special occasion.
  3. Regretting the act because it is disobedience to Allah.
  4. Resolving sincerely at the time of repentance not to return, while taking practical measures that support steadfastness.
  5. Repenting from accompanying prohibitions, such as viewing nakedness, engaging in prohibited conversations, or neglecting prayer.
  6. Restoring people's rights and removing harm if the matter involved spying, blackmail, private images, or violating someone's privacy, while seeking trustworthy help that stops the harm without increasing it.

Allah Most High says:

{قُلْ يَا عِبَادِيَ الَّذِينَ أَسْرَفُوا عَلَى أَنْفُسِهِمْ لَا تَقْنَطُوا مِنْ رَحْمَةِ اللَّهِ إِنَّ اللَّهَ يَغْفِرُ الذُّنُوبَ جَمِيعًا إِنَّهُ هُوَ الْغَفُورُ الرَّحِيمُ} [al-Zumar: 53].

Meaning: {Say, O My servants who have transgressed against themselves, do not despair of Allah's mercy. Indeed, Allah forgives all sins. He is truly the All-Forgiving, the Most Merciful.}

A Muslim must not use the vastness of forgiveness as an excuse to continue, nor make repeated failure a reason for despair. For a fuller explanation of the conditions of repentance, read How to Repent to Allah Sincerely.

A Practical Plan for Quitting Masturbation

Close the Triggers and Means of Access

Delete the images, videos, accounts, and conversations that arouse desire. Activate content filters and safe search, and close the means of access you have been accustomed to using. Do not retain prohibited material on the claim that you will resist it; sincerity in quitting appears in distancing yourself from the causes of temptation.

Identify the Triggers and Change the Environment

The act may be preceded by recurring causes, such as staying up late, loneliness, boredom, psychological pressure, random browsing, or remaining for a long time in a closed place with a device. Identify the cause, time, and place in general terms, then change the environment before the desire intensifies.

Helpful measures include:

  1. Charge the phone outside the bedroom.
  2. Do not take the device to bed or to a private place where weakness repeatedly occurs.
  3. Use devices in an open area of the home during high-risk times.
  4. Reduce late nights and regulate sleep.
  5. Remove accounts and applications that open the door to arousal.
  6. Give the content-restriction passcode to a trustworthy person when needed.

Interrupt the Wave of Desire Quickly

Do not remain alone with a trigger while negotiating with yourself. When the desire begins:

  1. Close the device or page immediately, without one last look.
  2. Get up and move to an open place or sit with your family.
  3. Make wudu, seek refuge with Allah, and ask Him for chastity and steadfastness.
  4. Engage your body in walking, exercise, or beneficial work.
  5. Begin a short, defined task that takes you away from idleness.
  6. Contact a trustworthy person with whom you have arranged accountability, without recounting prohibited details.

No matter how intense a desire becomes, it does not remain at one level. If you cut off its causes and do not feed it with looking and fantasy, it will weaken, Allah willing.

Seek Help Through Fasting

The Prophet, peace and blessings be upon him, directed whoever is unable to marry to fast because it helps restrain intense desire. A Muslim may observe as many voluntary fasts as he or she is able without causing self-harm or neglecting an obligation, while continuing to lower the gaze and close the triggers. Fasting does not mean abandoning the other means.

Marry If You Are Able While Continuing Treatment

Marriage is among the greatest means of chastity for someone able to bear its financial obligations, rights, and responsibilities. It is not, however, an automatic cure for a behavior that has become deeply rooted over time. A person should not postpone treating the habit until after marriage, nor wrong a spouse by expecting the other person to solve the problem alone.

Fill Your Time with a Realistic Routine

Long periods of idleness, isolation, and staying up late feed many harmful habits. Set a realistic routine that includes prayer on time, a regular portion of the Quran and adhkar, work or study, permissible exercise, righteous companionship, and regular sleep. A small, consistent routine is more beneficial than an extreme plan that collapses after a few days.

Seek Trustworthy Accountability When Needed

You may choose a righteous and wise person of the same sex whose religious commitment and discretion you trust, and ask that person to help you remain accountable in implementing the barriers and plan. You do not need to describe the details of the act or what you viewed. It is enough to say that you remained committed or became weak and need to strengthen the plan.

Seeking confidential help for an Islamic ruling or treatment is not publicizing a sin. What is prohibited is for a person to expose what Allah has concealed without a need or to boast about the sin.

Seek Professional Treatment If the Behavior Becomes Compulsive

Not every repetition is a medical diagnosis. However, if the behavior becomes compulsive, the person cannot control it despite serious attempts, or it affects prayer, work, study, marriage, or mental health, he or she should seek help from a qualified and trustworthy therapist who respects the person's faith and privacy.

Permissible treatment does not contradict repentance or reliance upon Allah; rather, it is part of taking the proper means. A professional may need to treat anxiety, depression, trauma, isolation, or difficulty controlling impulses. If the problem is accompanied by thoughts of harming oneself or others, urgent help is required.

What Should You Do If You Relapse?
Article Section

What Should You Do If You Relapse?

If the repentance was sincere at the time and the person later became weak and returned, he or she should not say, "Repentance is useless." Rather, the person should stop immediately, repent from the new sin, identify the door through which it entered, and add a stronger barrier.

After a relapse:

  1. Do not continue on the pretext that the day has already been ruined.
  2. Renew repentance, and do not abandon prayer or the Quran because of shame.
  3. Identify the immediate cause: a device, staying up late, isolation, forbidden viewing, or psychological pressure.
  4. Repair the weakness in the plan that same day.
  5. Seek accountability or professional treatment if the same pattern keeps recurring.

For further detail, read How to Repent from the Same Sin Repeatedly.

Rulings of Purification, Ghusl, and Wudu
Article Section

Rulings of Purification, Ghusl, and Wudu

The rulings of purification differ according to what occurred:

  1. If semen is discharged, ghusl is required for both men and women, and prayer is not valid before ghusl when a person is able to perform it.
  2. If madhy is discharged, a man washes his private part and testicles, a woman washes the affected area, and the Muslim sprinkles or washes whatever reached the clothing, then performs wudu. Ghusl is not required because of madhy.
  3. If neither semen nor madhy is discharged, ghusl is not required. However, directly touching the private part without a barrier invalidates wudu according to the stronger view, so wudu must be performed for prayer.
  4. Prayer while in a state of janabah without purification is invalid. Whoever did so must repent and repeat the prayers performed without purification. If many previous prayers are involved or their number is uncertain, the person should ask a trustworthy scholar how to make them up and should not open the door to obsessive doubt.

The correct method of ghusl is explained in How to Perform Ghusl from Janabah.

The Ruling on Masturbation While Fasting
Article Section

The Ruling on Masturbation While Fasting

Whoever deliberately masturbates during the daytime of an obligatory fast and ejaculates has invalidated the fast, must repent to Allah, and must make up that day. The expiation required for intercourse is not due according to the stronger view, because the severe expiation was prescribed for intercourse, while the act remains prohibited and repentance from it remains obligatory.

If a person deliberately commits the act but does not ejaculate, the fast is not invalidated by that alone according to the stronger view, although the person is sinful for the prohibited act and for violating the sanctity of the fast. If madhy rather than semen is discharged, it does not invalidate the fast according to the stronger view, but the affected area must be washed and wudu performed for prayer.

Whoever is unsure about the type of discharge or has a complex case should ask a trustworthy scholar and should not base worship on guesswork.

Between the Islamic Ruling and Medical Claims
Article Section

Between the Islamic Ruling and Medical Claims

The prohibition of masturbation is established by Islamic evidence, so there is no need to attribute every illness circulated among people to it. It is not correct to state with certainty that it causes blindness, permanent infertility, or other claims without reliable medical evidence.

Nevertheless, when it develops into compulsive behavior, it may consume time, weaken concentration, become connected to viewing forbidden material, isolation, and anxiety, and affect worship, study, work, and marriage. Whoever experiences physical or psychological symptoms should present them to a qualified physician or therapist and should not diagnose himself or herself based on unidentified videos.

A Comprehensive Supplication for Chastity
Article Section

A Comprehensive Supplication for Chastity

One of the supplications of the Prophet, peace and blessings be upon him, is:

"اللَّهُمَّ إِنِّي أَسْأَلُكَ الْهُدَى، وَالتُّقَى، وَالْعَفَافَ، وَالْغِنَى".

Meaning: "O Allah, I ask You for guidance, piety, chastity, and contentment."

Reported by Muslim.

A Muslim should make this supplication and ask Allah to guard his or her gaze and chastity, purify the heart, and turn away evil and immorality, while sincerely striving and taking the proper means.

Frequently Asked Questions About Masturbation
Question and Answer

Is Masturbation Zina?

It is not zina in the technical legal sense that entails the prescribed punishment for zina, and it must not be equated with it in every ruling. It is nevertheless prohibited according to the stronger view and must be repented from. Other sins, such as viewing nakedness or neglecting prayer, may also accompany it.

Question and Answer

Is Masturbation a Major Sin?

What is established is that it is prohibited and must be abandoned and repented from. This does not depend on whether scholars classify it technically as a major or minor sin. Its gravity increases through persistence, its association with forbidden viewing, its occurrence during the daytime in Ramadan, or its causing obligations and rights to be neglected. It must not be taken lightly, but no one should despair of repentance because of it.

Question and Answer

Does It Take a Person Out of Islam?

Merely committing it does not take a Muslim out of Islam; it is a sin, not disbelief. The person must repent and may not regard as permissible what Allah has prohibited. One of the principles of Ahl al-Sunnah is that a Muslim is not declared a disbeliever for every sin, and that faith increases through obedience and decreases through disobedience.

Question and Answer

Does Allah Forgive Someone Who Repeatedly Commits the Sin?

Yes. Whoever sincerely repents before death reaches him will be forgiven by Allah, no matter how long the sin continued or how often it recurred. A person must not despair of Allah's mercy or delay repentance on the claim that perfection cannot be achieved from the first day.

Question and Answer

Does Returning to the Sin Invalidate the Previous Repentance?

Not necessarily. If the person stopped, regretted the sin, and sincerely resolved to quit at the time of repentance, but later became weak, a new repentance is required for the new sin. As for someone who said that he repented while intending to return at the first opportunity, he did not fulfill the required resolve.

Question and Answer

Does Intense Desire or Fear of Zina Make It Permissible?

No. Intense desire, delayed marriage, or merely fearing zina does not make it permissible. The Prophet, peace and blessings be upon him, directed whoever is able to marry and whoever is unable to fast, together with lowering the gaze and avoiding the causes of temptation. A Muslim must not use fear as an excuse to commit it or grant himself or herself an exception merely because desire is intense. Instead, the person should use the permissible means of chastity and seek Allah's help.

Question and Answer

Does Marriage Automatically Solve the Problem?

Marriage is a great means of chastity, but it does not automatically remove an entrenched habit or an attachment to forbidden content. A person should begin treatment before marriage and continue lowering the gaze and closing the triggers afterward.

Question and Answer

When Is Ghusl Required?

Ghusl is required when semen is discharged. Madhy requires washing the affected area and whatever it touched, as well as performing wudu, but it does not require ghusl. If nothing is discharged, ghusl is not required, although wudu is required if the private part was touched directly without a barrier, according to the stronger view.

Question and Answer

Does It Invalidate the Fast?

If a fasting person deliberately commits it and ejaculates, the fast is invalidated, and both making up the day and repenting are required. The expiation for intercourse is not required according to the stronger view. If ejaculation does not occur, the fast is not invalidated merely by the act according to the stronger view, though the sin remains and repentance is required.

Question and Answer

Is There a Prescribed Punishment or Specific Expiation for It?

The basic ruling carries no prescribed punishment and no specific financial or physical expiation. What is required is sincere repentance, stopping, regret, and resolving not to return. If another ruling results from it, that ruling applies. Whoever ejaculates during the daytime of an obligatory fast must make up that day, and whoever prayed while in a state of janabah must repeat the prayer performed without purification. The severe expiation for intercourse is not required because of masturbation according to the stronger view.

Question and Answer

Are Prayers Not Accepted for Forty Days?

There is no established evidence that masturbation prevents a prayer from being valid or accepted for forty days. Whoever commits it must perform the required purification, pray every prayer on time, and repent to Allah. A person must not add the sin of abandoning prayer to the original sin.

Question and Answer

Does the Ruling Apply to Women?

Yes. The basic prohibition applies to men and women because the texts concerning chastity and guarding the private parts are general. The rulings of ghusl likewise apply when semen is discharged by a man or woman.

Question and Answer

Does Intimacy Between Spouses Have the Same Ruling?

Intimacy between spouses within what Allah has permitted is lawful in principle and does not take the ruling of prohibited solitary masturbation. They must avoid intercourse during menstruation and postpartum bleeding, anal intercourse, everything whose prohibition is established, and anything that results in recognized harm.

Question and Answer

Is a Wet Dream a Sin?

No. A wet dream occurs without choice, so there is no sin in it. If the person finds semen after waking, ghusl is required. If nothing is found, ghusl is not required.

Question and Answer

Must the Sin Be Disclosed to Someone?

The basic principle is that a Muslim should conceal his or her sin and repent to Allah, without mentioning its details unnecessarily. A person may disclose only what is needed to a trustworthy scholar, qualified therapist, or reliable person helping with accountability, without arousing descriptions or unnecessarily expanding the circle of those who know.

Question and Answer

What Should Parents Do If They Discover It in Their Son or Daughter?

They should address it privately and wisely, without exposure, ridicule, threats, hitting, or humiliation. They should explain the ruling in age-appropriate language, teach the rulings of puberty and purification, close the triggers and unregulated means of access, and strengthen healthy companionship, the daily routine, and calm accountability. If the behavior becomes compulsive, is connected to harmful content, or involves exploitation, they should seek trustworthy assistance that protects the son or daughter's safety and privacy.

Parents may also consult Signs of Puberty and Religious Accountability.

Question and Answer

What About a Genuine Medical Need?

A genuine medical need is a specific situation assessed according to its extent; it is not a general permission to practice the habit. If a specialist physician requests a necessary examination, the patient should seek the permissible option involving the least prohibition, preserve his or her privacy, and, when possible, ask a trustworthy scholar about the details before proceeding. Curiosity, an unnecessary examination, or using medical need as a pretext to continue does not fall under this allowance.

Question and Answer

When Should Professional Help Be Sought?

If the behavior becomes compulsive, continues despite barriers and serious attempts, disrupts prayer, study, or work, or harms marriage and mental health, professional assistance is beneficial and important. Treatment and repentance do not conflict; a Muslim combines both.

The Path to Chastity Begins Today
Conclusion

The Path to Chastity Begins Today

Quitting masturbation is not achieved merely by blaming oneself. It requires sincere repentance, lowering the gaze, closing the triggers, organizing one's time, fasting, marriage for whoever is able, and seeking help when needed. Whoever is sincere with Allah, takes the proper means, and strives against the self should expect good. Allah Most High says:

{وَالَّذِينَ جَاهَدُوا فِينَا لَنَهْدِيَنَّهُمْ سُبُلَنَا وَإِنَّ اللَّهَ لَمَعَ الْمُحْسِنِينَ} [al-Ankabut: 69].

Meaning: {As for those who strive for Our sake, We will surely guide them along Our ways. And Allah is certainly with those who do good.}

Begin today by closing the nearest door that leads you back to the sin, put a practical barrier in place, maintain the prayer, and do not despair if you slip. Rather, repent, improve your plan, and continue on the path to Allah.