The correct scholarly view is that masturbation is haraam. For more information please see the answer to question no. 329.
With regard to the rulings concerning the daytime in Ramadaan, please see the answer to question no. 38074.Â
Young men have to fear Allaah their Lord, and keep away from listening to or looking at the things that will provoke their desire. They should make the most of Ramadaan to discipline themselves, for this is the month of the Qurâan and the month of piety. It is not befitting for a Muslim to fail to make the most of this month to forsake forbidden desires and seek reward, fearing his Lord. Allaah says of the fasting person in a hadeeth qudsi: âHe forsakes his food, his drink and his desires for My sake.â Narrated by al-Bukhaari, 1894; Muslim, 1151.Â
Shaykh Ibn âUthaymeen said:Â
One should be patient in avoiding masturbation, because it is haraam as Allaah says (interpretation of the meaning):Â
âAnd those who guard their chastity (i.e. private parts, from illegal sexual acts)
6.Â Except from their wives or (the slaves) that their right hands possess, for then, they are free from blame;
7.Â But whoever seeks beyond that, then those are the transgressorsâÂ
And the Prophet (peace and blessings of Allaah be upon him) said: âO young men, whoever among you can afford to get married, let him do so, for it is more effective in lowering the gaze and guarding oneâs chastity. And whoever cannot afford that should fast.âÂ
If masturbation were permissible, the Prophet (peace and blessings of Allaah be upon him) would have told them to do it, because it is easier and because people find pleasure in it, unlike fasting which is difficult. Because the Prophet (peace and blessings of Allaah be upon him) enjoined fasting instead, this indicates that masturbation is not permissible.Â
Majmooâ Fataawa al-Shaykh Ibn âUthaymeen, 19.189.Â
You should try hard to get married so that you can give up this bad habit. Seek the help of your Lord by praying to Him and obeying Him, so that you can rid yourself of this sinful habit.Â
We ask Allaah to purify your heart and protect you from sin, and to help you to do that which He loves and which pleases Him.Â
And Allaah knows best.