بسم الله الرحمن الرحيم
(Fatwa: 1373/1349/L=11/1438)
You have heard right that masturbation is haram and major sin. This ruling is for both male and female. If you are unmarried then keep on supplicating Allah for good match and instead of wrong thoughts in privacy keep yourself busy in dua, salah, recitation etc and avoid seeing objectionable picture and yet if you have wrong thoughts then remember the warnings and punishment of Allah. If you do so, in-shaAllah you shall get rid of this bad practice.
Allah knows Best!
Darul Ifta,
Darul Uloom Deoband