Islam is a comprehensive religion for the orderliness of human existence in various aspects of life. It has addressed matter of natural disposition with moderation. Allah, the most high, says:

‘And they who guard their private part. Except from their wives or those their right hands possess, for indeed, they will not be blamed. But whoever seeks beyond that, then those are the transgressors’ Suratul Mu’minoon.

For that reason, undoubtedly, masturbation is forbidden according to Islamic ruling and doing it is a sin.

It will not be made permissible unless it occurs as a result of unavoidable cause, for instance if someone is having stomach ache due to excess sperm (in his scrotal sac). With this such a person will prevent himself from committing adultery. Masturbation usually  cause discomfort for one who is addicted to it. It also weakens one’s matrimonial home. Whoever engages in it and sperm comes out of his body, ritual bath is compulsory for him. If it’s done between close intervals and, not within the time frame of prayers, such a person will have a single bath. But we should be reminded that masturbation is wrong. May Allah protect our young men and women from masturbation. And may He ease our affairs as regard marital life.