Masturbation is a self-gratifying sexual act usually in a private setting. The Bible does not directly talk about masturbation as a sinful act, but there are related verses in Scripture that have something to do with the act itself.
Most masturbation acts require some sort of stimulation on the part of the person. Some find these stimuli through immoral or pornographic materials, and/or media. While the Scriptures is silent when it comes to the actual act, it is not when pertaining to lusting after another person who isn’t your spouse.
Jesus Christ made it clear that adultery and fornication are not just committed in action, but also in the mind and heart. If a person entertains lustful temptations, and then proceeds with the act of masturbation, he had committed sin in his heart.