يَا أَيُّهَا الَّذِينَ آمَنُوا لَا يَسْخَرْ قَوْمٌ مِّن قَوْمٍ عَسَىٰ أَن يَكُونُوا خَيْرًا مِّنْهُمْ وَلَا نِسَاءٌ مِّن نِّسَاءٍ عَسَىٰ أَن يَكُنَّ خَيْرًا مِّنْهُنَّ وَلَا تَلْمِزُوا أَنفُسَكُمْ وَلَا تَنَابَزُوا بِالْأَلْقَابِ بِئْسَ الِاسْمُ الْفُسُوقُ بَعْدَ الْإِيمَانِ وَمَن لَّمْ يَتُبْ فَأُولَٰئِكَ هُمُ الظَّالِمُونَ
سورة الحجرات الاية 11

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. Evil is the return to wickedness after having attained faith. Whoever does not repent — these are the wrongdoers.

―Quran 49:11

Islam counsels us to follow a better path when people insult us by not responding to them in the same manner, but rather to respond to their evil with good. Gentleness and forbearance are the general rules we need to follow in most situations.

ادْفَعْ بِالَّتِي هِيَ أَحْسَنُ
Not equal are the good deed and the bad deed. Repel evil by that which is better, and then the one who is hostile to you will become as a devoted friend. But none is granted it except those who are patient and none is granted it except one having a great fortune.
—Quran 41:34-35

Allah/God has commanded the believers in several verses to repel evil with good by being patient, merciful, and forgiving when confronted with mistreatment. Allah has praised those who respond to evil with good deeds.