Answer
It is definitely a sin to swear (curse, cuss, etc.). The Bible makes this abundantly clear. Ephesians 4:29 tells us, "Do not let any unwholesome talk come out of your mouths, but only what is helpful for building others up according to their needs, that it may benefit those who listen." First Peter 3:10 declares, "For, whoever would love life and see good days must keep his tongue from evil and his lips from deceitful speech." James 3:9-12 summarizes the issue: "With the tongue we praise our Lord and Father, and with it we curse men, who have been made in God’s likeness. Out of the same mouth come praise and cursing. My brothers, this should not be. Can both fresh water and salt water flow from the same spring? My brothers, can a fig tree bear olives, or a grapevine bear figs? Neither can a salt spring produce fresh water."
James makes it clear that the lives of Christians - the "brothers" - should not be characterized by evil speech. By making the analogy of both salt water and fresh water coming from the same spring (which is uncharacteristic of springs), he makes the point that it is uncharacteristic for a believer to have both praise and cursing come from his/her mouth. We cannot praise God while at the same time cursing our brothers.
Jesus explained that what comes out of our mouths is that which fills our hearts. Sooner or later, the evil in the heart comes out through the mouth in curses and swearing. But when our hearts are filled with the goodness of God, praise for Him and love for others will pour forth. Our speech will always indicate what is in our hearts. "The good man brings good things out of the good stored up in his heart, and the evil man brings evil things out of the evil stored up in his heart. For out of the overflow of his heart his mouth speaks" (Luke 6:45).
Why is it a sin to cuss / swear / curse? Sin is a condition of the heart, the mind, and "the inner man" (Romans 7:22), which is manifested in our thoughts, actions and words. When we swear and curse, we are giving evidence of the polluting sin in our hearts that must be confessed and repented of. When we put our faith in Christ, we receive a new nature from God (2 Corinthians 5:17), our hearts are transformed, and our speech reflects the new nature God has created within us (Romans 12:1–2). Thankfully, when we fail, our great God is "faithful and just and will forgive us our sins and purify us from all unrighteousness" (1 John 1:9).