Praise be to Allah.
The basic principle with regard to insulting people and putting them down, or mentioning their faults is that it comes under the heading of bad attitudes and abhorrent behaviour, whether that is done verbally or in one’s heart. It is one of the faults that may have an impact on one’s tongue or heart, and generate in his heart resentment, hatred and scorn towards people, and it distracts a person from the sublime aim for which he was created, which is to fill the world with righteous deeds and good attitudes. The heart that is focused on hating people and reviling them is far removed from purity and far removed from that humility before one’s Lord which is tranquillity and contentment with that which is with Allah, may He be exalted. Allah, may He be glorified and exalted, says (interpretation of the meaning):
“Verily, those who believe (in the Oneness of Allah - Islamic Monotheism) and do righteous good deeds, and humble themselves (in repentance and obedience) before their Lord, - they will be dwellers of Paradise to dwell therein forever”
Imam al-Ghazaali (may Allah have mercy on him) said, in a chapter on the prohibition on backbiting in one’s heart:
Just as it is prohibited for you to speak ill of someone verbally in front of others, it is also not right for you to talk to yourself and think ill of your brother… The more you have bad thoughts about a Muslim, the more you should care for him and pray for him, because that will annoy the Shaytaan and push him away from you, so that he will not instil bad thoughts in you lest you resort to offering supplication for your brother and caring for him. Whatever faults you find in your brother, offer him advice in private and do not let the Shaytaan deceive you and call you to backbite about him.
End quote from Ihya’ ‘Uloom ad-Deen (3/150).
This applies if you revile and impugn him in secret him with no justification. But if there was some justification and it was done to ward off the mistreatment of a wrongdoer or transgression of a transgressor, then there is no sin in that and no blame. Allah, may He be glorified and exalted, says (interpretation of the meaning):
“Allah does not like that the evil should be uttered in public except by him who has been wronged. And Allah is Ever All-Hearer, All-Knower”
However it is also preferable not to revile and impugn him, and to focus on that which will rectify and purify the heart.
On our website we have previously answered a similar question in detail; please see fatwa no. 136415.
And Allah knows best.