There are several recipes for pepper spray you can find online. Though they can be concocted quickly and would probably be quite painful if sprayed in the eyes, these quick recipes only roughly reproduce commercial methods of manufacture. Quick pepper spray can be made by mixing 2 tbsp. of finely ground cayenne pepper with enough isopropyl alcohol to cover the powder, and roughly one-third as much baby oil. Real pepper spray uses similar ingredients but allows the capsaicin to concentrate by letting the powder steep in the alcohol for several hours up to several days. The alcohol is then evaporated off, and the remaining resin is mixed into an emulsion of propylene glycol and water. Each state has its own laws restricting the maximum concentration of capsaicin in the spray, and some limit the size of the canister. Synthetic analogues of capsaicin are used, including pelargonic acid vanillylamide, which is popular in England, and pelargonic acid morpholide, in use in Russia.
Practically speaking, pepper spray is only as effective as the ability of its user to project it at an attacker. Most homemade pepper spray is put into pump action spray bottles, which produces a short range mist. This creates a significant disadvantage compared with commercial pepper spray because the spray bottle likely has significantly less reach and allows the ingredients to separate between uses, which could result in the spraying of relatively benign matter. Aerosol canisters, on the other hand, keep the ingredients under constant pressure, resulting in a uniform consistency in every use. They can also propel the pepper spray several feet in a fast, narrow stream that is more likely to reach an assailant before he is able to close his eyes or otherwise evade the spray.