Is it still considered a sin if one only thinks about committing a sin but does not go ahead with the sin?
Sins can be committed both in our minds and by our actions. God tells us in the gospel of Matthew that we can sin in our minds: for example by being angry with someone or by lusting after someone.
You have heard that the ancients were told, ‘YOU SHALL NOT COMMIT MURDER ‘ and ‘Whoever commits murder shall be liable to the court.’ But I say to you that everyone who is angry with his brother shall be guilty before the court . . . (NASB) Matthew 5:21-22
Here we are told that a person can commit the sin of murder both by action and by being angry. God restates this truth in the following passage,
You have heard that it was said, ‘YOU SHALL NOT COMMIT ADULTERY’; but I say to you that everyone who looks at a woman with lust for her has already committed adultery with her in his heart. (NASB) Matthew 5:27-28
We have discovered that a person can sin by giving in to an inner emotion or passion and then dwelling on that emotion or passion. James 1:14-15 tells us that sin does not occur until we have decided to give in to our internal feelings.
But each one is tempted when he is carried away and enticed by his own lust. Then when lust has conceived, it gives birth to sin; and when sin is accomplished, it brings forth death. (NASB) James 1:14-15
It is not a sin to look at a woman, or to find her attractive. It is not a sin to think that a man is handsome and might be a very romantic husband. But if a married man or woman goes farther and starts dreaming about having sex, being kissed, or having sex with someone other than his or her spouse, then he or she has sinned.
James reveals that sin does not occur when the emotion, thought, or passion first comes. But if those thoughts are not resisted, then sin occurs when we give in to the emotion, thought, or passion by dwelling on it. Also, once we have given in to our feelings by acting on them, we have sinned. That is Jesus’ message in the following verse.
But the things that proceed out of the mouth come from the heart, and those defile the man. For out of the heart come evil thoughts, murders, adulteries, fornications, thefts, false witness, slanders. (NASB) Matthew 15:18-19
Therefore, a person sins by dwelling on something that God has told us to avoid. When we sin on the outside we demonstrate to God, to others, and to ourselves that we have already sinned on the inside. God has asked us to resist the temptation to sin by fleeing from it. We are not supposed to see how close we can come without sinning. Fleeing starts with avoiding thoughts about the sin.
Flee immorality . . . (NASB) 1 Cor. 6:18
Therefore, my beloved, flee from idolatry. (NASB) 1 Cor. 10:14
For the love of money is a root of all sorts of evil, and some by longing for it have wandered away from the faith and pierced themselves with many griefs. But flee from these things, you man of God, and pursue righteousness, godliness, faith, love, perseverance and gentleness. (NASB) 1 Tim. 6:10-11
Now flee from youthful lusts and pursue righteousness, faith, love and peace, with those who call on the Lord from a pure heart. (NASB) 2 Tim. 2:22
God has called us to be holy even as He is holy (1 Pet. 1:14-16). Therefore, be holy!