Protecting yourself with pepper spray is legal in all 50 states, but there are restrictions on how you can use it. As a general rule, you can use it in self-defense to protect yourself from a real and immediate threat. As a self-defense product, pepper spray is not meant to permanently disable the attacker. Rather, it's a diversionary tool that can give you time to get away safely.
TL;DR (Too Long; Didn't Read)
You shouldn't go to jail for using pepper spray in genuine self defense, but if you attack someone with it for some other reason, assault and battery charges might be on the menu for you.
Pepper Spray is Legal in All States
It is legal to possess pepper spray in all 50 states. However, possession and use are regulated in most jurisdictions. In Nevada, for example, you're restricted from carrying more than two fluid ounces of pepper spray; in Wisconsin, you cannot camouflage the container. Massachusetts classifies pepper spray as a type of ammunition that can only be carried by someone over 18, or by someone under 18 who has a legal firearms permit obtained from a police department. Most states have rules against using pepper spray on law enforcement officials.
Proportionate and Necessary Force
In most states, it's acceptable to defend yourself from an unlawful attack. The important thing is that you're acting in self defense, and that you use force which is "necessary" and "proportionate" to the threat you're experiencing. For example, if someone pulled a gun on you, using your pepper spray would likely be seen as an act of self defense. If you pulled out your pepper spray just because you didn't like the look of someone, a court might decide that your response was neither "necessary" nor "proportionate."
Intentional Harm to Another
It is illegal to hurt someone intentionally. If you use your pepper spray on someone for a reason other than self-defense, there's a chance that you will end up in court for assault, battery or both. The same applies if you were acting in self-defense but you provoked the original attack. For example, you cannot threaten violence with a weapon and then claim self-defense if the person retaliates in some way, causing you to use your pepper spray. If witnesses testify that you were the aggressor, then you will not be justified in using your pepper spray.
Making a Case For Self Defense
If you hurt someone with your pepper spray, whether in self-defense or otherwise, it's possible that you could end up in court charged with some type of assault or battery. It is up to you and your defense attorney to prove there was legal justification for self defense. If you were truly defending yourself and you can prove it, then it is unlikely that you would be convicted of a crime. However, if a court decides that you used the spray improperly, you could be fined up to $1,000 or imprisoned for up to three years, depending on the jurisdiction. Every state has its own laws on the punishment of assault and battery.