The devil is a liar. If you had really committed this sin you wouldn't care. We all get strange thoughts from time to time.
The bottom line is this: if you are truly concerned, you have not committed the unforgivable sin.
Rather than demonstrating concern, those who actually commit the unpardonable sin are hardened off from Christ and Christianity and have no interest in His forgiveness.
The Pharisees mentioned by Matthew militantly hated Christ and attributed His miracles to Beelzebub, the prince of demons. Unlike those who are afraid they have committed the unforgivable sin, the Pharisees were totally unconcerned about Christ’s forgiveness.
If you're not a Christian, you need to become one. The fact you care is proof that you certainly can.
1) Admit you are a sinner and turn away from your sin.
Acts 3:19 says: "Repent, then, and turn to God, so that your sins may be wiped out, that times of refreshing may come from the Lord."
Repent literally means "a change of mind that results in a change of action." To repent, then, means to admit you are a sinner. You change your mind to agree with God that you are a sinner. The resulting "change in action" is, of course, the turning away from sin and begins right away but is a life long process. Some sin falls away quickly and some slowly. Self-help recovery programs and Christian counseling may be helpful for the latter.
2) Believe Jesus Christ died on the cross to save you from your sins and give you eternal life.
John 3:16 says: "For God so loved the world that he gave his only Son, so that everyone who believes in him will not perish but have eternal life."
Believing in Jesus is also a part of repenting. You change your mind from unbelief to belief, which results in a change of action.
3) Come to him with faith.
In John 14:6 Jesus said: "I am the way, the truth, and the life. No one can come to the Father except through me."
Faith in Jesus Christ is a change of mind that results in a change of action—coming to him.
4) You may pray a simple prayer to God.
You may want to make your response to God a prayer. Prayer is simply communicating with God. Pray using your own words. There is no special formula. Just pray from your heart to God, and believe that he has saved you. If you feel lost and just don’t know what to pray, here’s a
prayer of salvation you can pray.
5) Now, don’t doubt.
Salvation is by
grace, through
faith. There’s nothing you did, or ever can do, to deserve it. It’s a free gift from God. All you have to do is receive it!
Ephesians 2:8 says: "For it is by grace you have been saved, through faith — and this not from yourselves, it is the gift of God."
6) Tell someone about your decision and join a group of Christians.
Romans 10:9-10 says, "If you confess with your mouth, 'Jesus is Lord,' and believe in your heart that God raised him from the dead, you will be saved. For it is with your heart that you believe and are justified, and it is with your mouth that you confess and are saved."