Pepper spray is an often recommended personal security solution — often recommended by people who have not tried it. I have tested high-quality pepper sprays on multiple occasions and have not been impressed with the results.
Pepper spray is really only effective if you manage a direct face strike. A hit on clothing or even on unprotected skin has almost no effect. A hit to the face can be very difficult in any situation that involves movement. In armed combat, we almost always train to shoot center mass (the chest area), because the head is such a difficult target to hit. In addition to being smaller, the head moves around much more than the chest.
Pepper spray is significantly more vulnerable to wind than bullets are. In an outdoor confrontation, you may end up creating a cloud of pepper spray that blows right back into your own face — certainly not the intended effect.
Pepper spray is unpleasant, but not incapacitating. It might discourage a drunken frat boy, but it will not dissuade a determined or experienced assailant.
Pepper spray is not effective, in most scenarios, against multiple assailants. If you manage to spray the first assailant, the others tend to cover their eyes with their forearms and rush you.
All that being said, there are situations where pepper spray can be a useful addition to your personal security toolbox. It can be an effective non-lethal tool for use against (some) dogs and less determined assailants. In addition, a sturdy canister of pepper spray can be held inside your fist and used as an impact weapon.
As usual, be sure to check the current laws in your area. Pepper spray is illegal in many nations, states, and municipalities.