The Bible is silent on whether or not masturbation is sin. What verses can we turn to in trying to determine if this is sin or not?
Sexual Immorality Starts in the Mind
James gives us insight into how sin starts. Sin begins with temptation as we read in 1:13-15 “Let no one say when he is tempted, ‘I am being tempted by God,’ for God cannot be tempted with evil, and he himself tempts no one. But each person is tempted when he is lured and enticed by his own desire. Then desire when it has conceived gives birth to sin, and sin when it is fully grown brings forth death.” Notice that James says we are tempted by our own desires. When we hold on to this desire it gives birth to sin and sin that is un-repented of leads to eternal death. Temptation itself is not a sin because Jesus was tempted by the Devil in the wilderness but Jesus resisted the Devil by quoting Scripture. Satan twisted the Scriptures and took them out of context but Jesus rightly divided the Word of God and the sword of the Spirit, the Word. The Word of God is powerful when fighting demonic weapons. When we give into temptation  and don’t resist the Devil by fleeing from him, then it becomes full blown sin.
You are not alone because Paul wrote that “No temptation has overtaken you that is not common to man. God is faithful, and he will not let you be tempted beyond your ability, but with the temptation he will also provide the way of escape, that you may be able to endure it” (1 Corinthians 10:13). That is a great promise from God that we are not helpless victims of our own lusts of the flesh. We can resist sexual immorality in our minds as we will later read.
Lusting is Sin
Jesus said “that everyone who looks at a woman [or a man] with lustful intent has already committed adultery with her [or him] in his [or her] heart” (Matt 5:28). This means that we can commit sexual immorality in our minds and that God sees it as being the same thing as the physical act of adultery. When we lust after a man or woman in our minds, then we are essentially committing adultery (if we are married) or fornication (if we are single). Even if no one knows about it, God knows about it and so do we. Our conscience condemns us if we have the Holy Spirit (Romans 2:1-3). Just as thinking sexual thoughts about someone other than your spouse is sexual immorality, so too is hating someone likened to committing murder in the heart (Matthew 5:21-23). There is only one thing that you can do when lustful thoughts come to your mind. Pray, recall some memory Bible verses , and when this temptation comes “Submit yourselves…to God [so that you can] resist the devil, and he will flee from you” (James 4:7).
Masturbation is Sexual Immorality of the Mind
Paul gives believers an imperative command by saying that “sexual immorality and all impurity or covetousness must not even be named among you, as is proper among saints [and that] there be no filthiness nor foolish talk nor crude joking” either (Ephesians 5:3-4). Even if we commit the act of adultery in our mind, it doesn’t make it an innocent act. Not the way God sees it. In fact Paul asks the Corinthians “Do you not know that your bodies are members of Christ? Shall I then take the members of Christ and make them members of a prostitute? Never! Or do you not know that he who is joined to a prostitute becomes one body with her? For, as it is written, ‘The two will become one flesh’” (1 Corinthians 6:15-16). That shocks most unbelievers. When a person is joined together with another outside of the bounds of marriage, the two become one and the same. You can essentially be joined together as one with a male or female prostitute because it is written “the two will become one flesh” and who wants to be one and the same with a female or male prostitute? Our bodies, being members of Christ, include our minds and because our minds are very much part of our body, when our minds commit adultery, it is the same as our bodies doing it.
From all the verses we have read we can clearly see that sexual immorality, certainly the physical act, but even the mental act, is the same as adultery. This includes those who are married and those who are single. Therefore, from the context of these Scriptures, we can see that masturbation is committing sexual immorality in the mind and if in the mind, it is the same as with the body (Matthew 5: 28). The Bible clearly warns us that you are to “Put to death…what is earthly in you: sexual immorality, impurity, passion, evil desire, and covetousness, which is idolatry. On account of these the wrath of God is coming” (Colossians 3:5-6).
My advice to you, whether single or married, is to “Flee from sexual immorality [because] every other sin a person commits is outside the body, but the sexually immoral person sins against his own body. Or do you not know that your body is a temple of the Holy Spirit within you, whom you have from God? You are not your own, for you were bought with a price. So glorify God in your body” (1 Corinthians 6:18-20). The final destination of the sexually immoral is the lake of fire (Revelation 21:8). Don’t let that be your end. If you have a problem with sexual temptation, learn to memorize Scripture , fall on your knees in prayer during temptations, make a covenant with your eyes to not look upon men or women who are not your spouse, and flee temptation when it comes. It will not end well for those who do not resist sexual immorality. Let not this proverb be about you: “So you will be delivered from the forbidden woman, from the adulteress with her smooth words, who forsakes the companion of her youth and forgets the covenant of her God; for her house sinks down to death, and her paths to the departed; none who go to her come back, nor do they regain the paths of life” (Proverbs 2:16-19).
More to read: Bible Verses About Purity 
Resource: New International Version Bible (NIV) THE HOLY BIBLE, NEW INTERNATIONAL VERSION®, NIV® Copyright © 1973, 1978, 1984, 2011 by Biblica, Inc.™ Used by permission. All rights reserved worldwide