The Prophet ﷺ spoke directly to your situation: "O young men, whoever among you is able to marry, let him marry, for it lowers the gaze and guards the private parts; and whoever is not able, let him fast, for it will be a shield for him" (Sahih al-Bukhari 5065, Sahih Muslim 1400). Pornography is unambiguously haram, being a direct violation of Allah's command to the believing men and women to lower their gaze and guard their chastity (Quran 24:30-31). As for masturbation, the four madhhabs prohibit it as a rule, resting on Allah's praise of "those who guard their private parts... but whoever seeks beyond that, those are the transgressors" (Quran 23:5-7): the Malikis and Shafiʿis hold it haram outright, while the Hanafis and Hanbalis — and Shaykh al-Islam Ibn Taymiyyah — permitted it only as the lesser of two evils for someone who genuinely fears falling into zina and can neither marry nor restrain himself by fasting. No school treats it as something good. Practically: fast as the hadith instructs, cut off the access itself (filters, no device alone in private), fill your time with beneficial work and righteous company, marry as early as you reasonably can, and never let shame stop you from repenting — for Allah says He forgives all sins (Quran 39:53). Falling into this sin does not put you outside Islam, and repeated repentance is never wasted.
Q&A · Youth & Parenting
I'm a young Muslim struggling with pornography and masturbation — is it sinful, and how do I stop?
Evidence — the daleel
On deen2u
Informational, not a personal fatwa. Consult a qualified scholar for rulings on your situation.