Why shouldn't people swear? It's rational to say it is a bad thing when you hurt someone's feelings with your bad words, but if a person swears and no one cares, is it still haram to say 'f*** you' for example.
Yes, by all means it's forbidden to swear. (reasoning and logic is in the last of the answer).
Why shouldn't people swear?
Because Allah said in Quran:
يَا أَيُّهَا الَّذِينَ آمَنُوا لَا يَسْخَرْ قَوْمٌ مِّن قَوْمٍ عَسَىٰ أَن يَكُونُوا خَيْرًا مِّنْهُمْ وَلَا نِسَاءٌ مِّن نِّسَاءٍ عَسَىٰ أَن يَكُنَّ خَيْرًا مِّنْهُنَّ ۖ وَلَا تَلْمِزُوا أَنفُسَكُمْ وَلَا تَنَابَزُوا بِالْأَلْقَابِ ۖ بِئْسَ الِاسْمُ الْفُسُوقُ بَعْدَ الْإِيمَانِ ۚ وَمَن لَّمْ يَتُبْ فَأُولَٰئِكَ هُمُ الظَّالِمُونَ
O you who have believed, let not a people ridicule [another] people; perhaps they may be better than them; nor let women ridicule [other] women; perhaps they may be better than them. And do not insult one another and do not call each other by [offensive] nicknames. Wretched is the name of disobedience after [one's] faith. And whoever does not repent - then it is those who are the wrongdoers.
but if a person swears and no one cares is it still haram to say 'f*** you' for example.
Yes, it's still haraam, regardless of whether he care or doesn't. swearing is not only a matter between two people, it's a bad behaviour that Allah forbade, so we shouldn't do it.
You shouldn't swear a muslim, as the hadith says:
Ibn Mas'ud (May Allah be pleased with him) reported:
The Messenger of Allah (pbuh) said, "Reviling a Muslim is Fusuq (disobedience of Allah) and killing him is (tantamount to) disbelief."
[Al-Bukhari and Muslim].
وعن ابن مسعود رضي الله عنه قال: قال رسول الله صلى الله عليه وسلم "سباب المسلم فسوق، وقتاله كفر
" ((متفق عليه)).
And you shouldn't swear a non-muslim, or what they worship, as Allah says:
وَلَا تَسُبُّوا الَّذِينَ يَدْعُونَ مِن دُونِ اللَّهِ فَيَسُبُّوا اللَّهَ عَدْوًا بِغَيْرِ عِلْمٍ ۗ كَذَٰلِكَ زَيَّنَّا لِكُلِّ أُمَّةٍ عَمَلَهُمْ ثُمَّ إِلَىٰ رَبِّهِم مَّرْجِعُهُمْ فَيُنَبِّئُهُم بِمَا كَانُوا يَعْمَلُونَ
And do not insult those they invoke other than Allah , lest they insult Allah in enmity without knowledge. Thus We have made pleasing to every community their deeds. Then to their Lord is their return, and He will inform them about what they used to do.
Although the translation says "And do not insult those they invoke other than Allah", which means don't swear what non-muslims worship, the Ayah is also understood as "And do not insult those who worship other than Allah", which means don't insult non-muslims themselves, in fact these two understandings are both acceptable, it's a matter of Arabic Language.
Also this story shows that you shouldn't be obscene or say obscene words, and shouldn't insult non-muslims (but, of course, do reply to them politely):
'A'isha reported that some Jews came to Allah's Apostle (may peace be upon him) and they said: Abu'l-Qasim (the Kunya of the Holy Prophet), as-Sam-u-'Alaikum (Let Boredom be upon you), whereupon he (the Holy Prophet) said: Wa 'Alaikum. A'isha reported: In response to these words of theirs, I said: But let there be death upon you and disgrace also, whereupon Allah's Messenger (may peace be upon him) said: 'A'isha, do not use harsh words. She said: Did you hear what they said? Thereupon he (the Holy Prophet) said: Did I not respond to them when they said that; I said to them: Wa'Alaikum (let it be upon you).
حَدَّثَنَا أَبُو كُرَيْبٍ، حَدَّثَنَا أَبُو مُعَاوِيَةَ، عَنِ الأَعْمَشِ، عَنْ مُسْلِمٍ، عَنْ مَسْرُوقٍ، عَنْ عَائِشَةَ، قَالَتْ أَتَى النَّبِيَّ صلى الله عليه وسلم أُنَاسٌ مِنَ الْيَهُودِ فَقَالُوا السَّامُ عَلَيْكَ يَا أَبَا الْقَاسِمِ . قَالَ " وَعَلَيْكُمْ " . قَالَتْ عَائِشَةُ قُلْتُ بَلْ عَلَيْكُمُ السَّامُ وَالذَّامُ . فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " يَا عَائِشَةُ لاَ تَكُونِي فَاحِشَةً " . فَقَالَتْ مَا سَمِعْتَ مَا قَالُوا فَقَالَ " أَوَلَيْسَ قَدْ رَدَدْتُ عَلَيْهِمُ الَّذِي قَالُوا قُلْتُ وَعَلَيْكُمْ " .
Swearing is not an Islamic behavior, nor it's acceptable to be in a muslim:
Ibn Mas'ud (May Allah be pleased with him) reported: The Messenger of Allah (pbuh) said, "A true believer is not involved in taunting, or frequently cursing (others) or in indecency or abusing."
وعن ابن مسعود رضي الله عنه قال: قال رسول الله صلى الله عليه وسلم : "ليس المؤمن بالطعان، ولا اللعان، ولا الفاحش، ولا البذي".
((رواه الترمذي وقال حديث حسن)).
And Allah loves polite muslims who have good morals, and rewards them generously:
Abud-Darda (May Allah be pleased with him) reported: The Prophet (pbuh) said, "Nothing will be heavier on the Day of Resurrection in the Scale of the believer than good manners. Allah hates one who utters foul or coarse language."
وعن أبى الدرداء رضي الله عنه: أن النبى صلى الله عليه وسلم قال: “ما من شئ أثقل في ميزان المؤمن يوم القيامة من حسن الخلق، وإن الله يبغض الفاحش البذي”
رواه الترمذي وقال: حديث حسن صحيح.
So, after these evidences, what is the logic behind forbidding swearing?
It's a bad behavior that will greatly harm the community and ruin it, even if the insulted one doesn't have a problem. It's like adultery and homosexuality forbidden, even though both sides want to do that in adultery and homosexuality.
Good morals are main elements of islam, The Prophet (PBUH) said:
Yahya related to me from Malik that he had heard that the Messenger of Allah, may Allah bless him and grant him peace, said, "I was sent to perfect good character."
وَحَدَّثَنِي عَنْ مَالِكٍ، أَنَّهُ قَدْ بَلَغَهُ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ " بُعِثْتُ لأُتَمِّمَ حُسْنَ الأَخْلاَقِ " .
- Good morals are preferred by all humans, and Muslims should be the best a human can so that non-muslims would be interested in joining Islam when they see Muslims characteristics.
Hope that's convincing.