ANSWER: The word we commonly use for this act is believed to have originated by combining the Latin words masturbari (meaning 'hand') and stuprare (meaning 'to defile'). The answer to your Bible question regarding this act of self-pleasure depends upon what standard we are using.
There is one answer the Bible offers if we are referring to the Law received by Moses and another answer if we use the Christian standard Jesus Christ and the apostle taught: "All unrighteousness is sin, and there is sin not leading to death." (1John 5:17)
The Bible standard Christians are to follow is much higher than the Old Testament law because it is based on the spirit (or intent) of God's commands and not the letter (the narrow, strict interpretation). Each day believers are having God's Law written in their hearts by him changing our nature (Romans 2:14 - 15).
In Matthew 5 Jesus reveals that even having wrong thoughts are a sin because it is a matter of the heart or love. He stated in his Sermon on the Mount that even if a man lusts after a woman in his heart (he does not carry out his desires fully) he has committed adultery with her (Matthew 5:27 - 28).
True love for another, based on the Bible, means not to harm them in any way as the Apostle Paul states (Romans 13:10). Since we are human (in the flesh), we all sin (Romans 3:10).
We ALL need to repent so Christ's blood and His righteousness stands in our place before God and allows us to have a close relationship with him. According to the Bible, what is called masturbation is NOT a sin if we are referring to the Law given in the Old Testament. The Law only judges by the letter (e.g. committing fornication or adultery), which are actions (not thoughts or attitudes) others can see.
For example, while there is a written law against adultery (the seventh commandment) there is no Bible law under the Old Covenant specifically forbidding or punishing this act. That said, as Christians we should be growing toward perfection and stop sinning even in our thoughts.
Jesus expanded upon God's requirements to obey him not only in deed but also in thoughts and intentions when he preached his Sermon on the Mount (Matthew 5:21 - 22, 27 - 28, 43 - 45, 48). The principles in the Bible that Jesus taught are the ones believers are to follow.