Here's a simple question: Is it ever ok to punch, hurt or even kill another human being?
The shortest and best answer is:
Yes, you are allowed to hurt or kill as needed if you are in personal danger.
This is the simple essence of self defense. Literally, defending yourself from harm. The idea is simple: Get them to stop trying to hurt or kill you. This may require hurting or even killing your attacker.
The concept of counter-attacking is a fundamental concept in all species of animals, even Homo sapien (otherwise known as the human race). All animals have at least one form of defense mechanism. Many have multiple options. Running away, teeth, claws, sprays, etc. etc. We have our body (fists, etc.) as well as tools available to us (pepper spray, etc.) Some prefer to take classes and learn improved ways to protect themselves. Other simply prefer to deal w/ the situation as it comes and use whatever they've learned along their travel in life. Both options are fine.
However, the main issue is scalability. Killing someone just because they called you names is NOT acceptable. That is complete over-reaction. If someone attacks you with punches, kicks, etc. then it's fine, proper and appropriate for you to punch and kick them back. If weapons are used against you, you are justified in using something to defend yourself. It's simple.
The ideal form of self defense is to stop your attacker without harming them in any way whatsoever. Perhaps talking them out of attacking you in the first place. Unfortunately, this option is not always available.
Some pacifists prefer a "do not retaliate, ever" methodology. Some go so far as to discourage defending yourself at all. The idea seems to be to "weather the storm" until your attacker leaves. Weathering the storm when you have the ability to defend yourself is not a form of defense. I admire what they are trying to do, but I am not aware of a single case where letting someone beat you has ever stopped them from doing so again in the future, not to mention them trying to attack others.
However, keep in mind not all forms of attack require physically damaging defenses. Verbal assaults can usually be remedied without physical attack. Inappropriate actions done by an employer or government can be counter-attacked via offiical channels of complaint. If that does not work and you still feel threatened, you can use peaceful protests, invoking the weapon of peer pressure.
What you are not allowed to do is to over-react and inflict mass injury on the original attacker after you have successfully stopped their attack. You do not get to "punish" them and call it self defense. Your job is to stop the attack and get the attacker to understand that any further assault will result in stronger methods of defense. Then if attacks continue later, it is acceptable to increase the intensity of your defense until they get the point that any attacks is a bad idea.
The issue of defending yourself starts at the personal level, but scales quite easily, even though many try to complicate the issue.