The easiest and cleanest way to make saltpeter, chemically known as potassium nitrate, is to mix ammonium nitrate, a common but hazardous fertilizer with potassium chloride, a sodium-free table salt substitute, in water at a warm but never boiling temperature. Stir the mixture well, and remove it from heat when both solids dissolve. Cool the solution in a freezer, and collect the saltpeter crystals that precipitate from the solution using a coffee filter or metal strainer.
For most of the history of gunpowder, producing pure saltpeter was not possible, as chemicals such as ammonium nitrate and potassium chloride were not readily available. Historically, people made saltpeter using a much more unpleasant process involving animal dung and urine.
In the older saltpeter production process, the maker mixes animal manure with a small amount of vegetable matter and ashes and then collects the mixture into a large pile. The maker keeps the mixture moist by periodically soaking the pile in stale urine, either from animals or people. After some time, yellow crystals form on the pile's surface. This crude form of saltpeter is then purified until it can be used in gunpowder or as fertilizer.
In addition to manufactured saltpeter, the material also occurs widely in nature. Large deposits of saltpeter exist in several areas of the word, often near potash deposits. Crude saltpeter also forms in caves with large numbers of bats, as the material naturally crystallizes on large piles of bat guano.