Several compounds can be used. A contact explosive made from phosphorus, sulfur, and potassium chlorate will explode when hit with the small hammer in a cap gun. This is similar to the mixture used in “strike anywhere” matches. An early formula (1926) used potassium chlorate, sulfur, and antimony.
Compounds that are very good oxidizing agents, such as potassium chlorate or potassium perchlorate, make explosives that are easy to set off, and are called contact explosives. Fuels that are very easily oxidized, such as sulfur, phosphorus, or antimony, are added to the powerful oxidizer, and the result is a very sensitive explosive.
You can tell if a cap has sulfur in it by the smell it makes when it explodes.
Other exploding toys, like the “bang snaps” novelty fireworks, use a high explosive called silver fulminate. A tiny amount of the explosive is added to some sand, which is then wrapped in thin paper. When thrown at something, the explosive makes a loud bang, but the sand absorbs most of the energy, so no damage is done.
Silver fulminate – a contact explosive
Fulminates are made by reacting gold, silver, mercury, or platinum with ammonia or nitric acid. Those metals don’t react easily, and the compounds they create break apart easily, releasing energy. Most contact explosives use compounds that break apart easily and release energy. Other examples are ammonium triiodide, tri-acetone tri-peroxide, lead azide, and lead styphnate.