Gunpowder (a generic term that includes black powder and smokeless powder) is a propellant that has been used in firearms and fireworks. The gases generated by burning gunpowder create enough pressure to propel a bullet, but not enough to destroy the barrel of the firearm.
Gunpowder is a low explosive – which means that it has a relatively slow rate of decomposition as it burns. The deflagration flame front of low explosives propagates at less than the speed of sound. By contrast, the deflagration flame front of high explosives propagates at supersonic rates and creates a high pressure shock wave called a detonation. However, it is possible for low explosives in a confined space to deflagrate very quickly and build up enough pressure to produce an effect similar to a detonation.
While black gunpowder and even smokeless powder have been used for commercial mining and earthmoving, since their low detonation velocity still has substantial explosive power, they have largely been replaced by more appropriate explosives. While smokeless powder may contain nitroglycerin or nitrocellulose, those ingredients are formulated differently when a high explosive effect is desired.
There are two broad classes of gunpowder, black and smokeless powder. Smokeless powder — a relative term, as it produces some smoke but not dense clouds — has replaced black powder for almost all applications not involving historical reenactment. Modern smokeless powders, of various formulations, are both safer and more powerful than black powder.
Black gunpowder was first developed in China, no later than the eleventh century A.D., and possibly earlier. (Early texts are not clear if the mixture described is true gunpowder or not.) It was introduced into Europe in the thirteenth century, through unknown routes. The earliest known description of a true gunpowder formula is in a letter from Francis Bacon to Pope Clement IV in 1267 A.D. By 1275, Albertus Magnus described a formula of four parts saltpeter (potassium nitrate) to one part charcoal (material) and one part sulfur; the chemically ideal proportions are closer to 75% saltpeter, 11.5% sulfur, and 13.5% charcoal. As a matter of interest, the combustion of black powder does not require any combustion air.
The earliest European gunpowder formula was a finely ground mixture of charcoal, potassium nitrate, and sulfur. This mixture, known as "serpentine powder," tended to absorb moisture, to separate into its components while being transported, and did not burn if packed too tightly into a gun. It gave way, in the 15th century, to corned powder which was pressed into pellets and screened to a uniform size.
Even with better mechanical formulation, black powder is extremely sensitive to friction and heat, and, while having less explosive power when confined, is far more dangerous to handle than smokeless powder. Aside from its use in historical applications, it still has applications as part of the initiating system of artillery shells.
Black powder has gradually been superseded by other propellants which provide higher energy density, lack of smoke, or other desirable properties. In the mid-19th century chemists realized that black-powder smoke wasted fuel, reducing muzzle velocity, while a smokeless powder converted all its fuel, allowing for increased velocity of projectiles. Increased velocity was necessary for rapid-fire shells and in battle against ironclad vessels. In 1884, Frenchman Paul Vieille invented smokeless gunpowder.
Modern smokeless powders are of three basic types:
- single-base propellant: Nitrocellulose and inert ingredients for mechanical properties
- double-base propellant: Nitrocellulose, nitroglycerin or other plasticizer of nitrocellulose, and inert ingredients for mechanical properties
- triple-base propellant: Nitrocellulose, nitroglycerin or equivalent, nitroguanidine, and inert ingredients for mechanical properties
After mixing the ingredients, smokeless powder is a plastic material that can be cast, extruded, or otherwise made into specific grain shapes and sizes. An actual propellant filling may have a mixture of grain shapes of different propellant types.
- Progressive grains, exemplified by rosettes and multiperforated types, increase the exposed area as they burn, increasing pressure over time
- Neutral grains, such as the perforated forms, expose a constant area
- Digressive grains, represented by cords, decrease the exposed area as they burn, thus decreasing pressure over time
"Grain geometry and burning rate are interrelated. The burning time of a propelling charge that contains a propellant with a high burning rate and strongly digressive grain geometry could be equal to the burning time of a charge that contains a propellant with a low burning rate and strongly progressive grain geometry." Short burning times are necessary in short-barreled firearms, which have only a limited time to transfer energy to the projectile. Short burning times with high instantaneous pressures, however, put greater stress on the metal barrel.
"European nations have favored the use of single perforation, strip, and cord propellants. The United States uses single perforation and multiperforation propellants. The single perforation grains may be slotted or unslotted. The slotted grain has the desirable characteristic of venting gas during combustion. All countries use ball propellants for small arms." These affect the burning time and the shape of the pressure-versus-time curve.
Burning time is related to the detonation velocity (or deflagration velocity) of the material, and the total surface area of propellant exposed. Grain shape affects the area exposed. Complex shapes allow control of the development of pressure.
A basic use of gunpowder was in hunting and sport firearms, regarded as tools in the 17th and 18th centuries. In the U.S., for example, E.I. du Pont started a gunpowder factory in Delaware in 1802, "at the urging of Thomas Jefferson, who advised him of the new American nation’s need of a domestic supply of high-quality gunpowder. Jefferson gave DuPont his first order, for the refining of some saltpeter (an ingredient in black powder)."
Miners began using gunpowder for excavation when Caspar Weindel invented the technique of packing manually driven drill holes with powder. Drill technique paced the utility of the method, but black powder was inherently limited and was replaced by dynamite. One of the limitations of black powder was its slow detonation velocity, so unless the drill holes were carefully sealed, much of the gas would escape. 
Smokeless gunpowder is standard in modern sport firearms, although there are historical reenactors who use black powder.
Gunpowder was used as a propellant for unguided rockets, and to propel shot in cannon. During the late 14th and early 15th centuries, Chinese gunpowder technology spread to the whole of Southeast Asia via both the overland and maritime routes, long before the arrival of European firearms. The impact of Chinese firearms on northern mainland Southeast Asia in terms of warfare and territorial expansion was profound.
Technological developments of guns themselves affected the desired characteristics of propellants; advances in propellants allowed developments of new gunnery technologies. Until the 19th century, gunnery was at short range, which allowed short, unrifled barrels. Scientific study of gunnery began with exterior ballistics, or the behavior of projectiles in flight, but, in the 19th century, began to explore interior ballistics, or the behavior of projectiles in the gun.
Carl Bomford, a U.S. Army lieutenant colonel who was Chief of Ordnance, created an apparatus to measure the pressure vs. time in a gun barrel. He drilled holes at equal distances along the cannon barrel, to which pistol barrels, loaded with a bullet, were attached. When the cannon was fired, the pressure wave propelled the bullets down the barrels, where they struck devices called ballistic pendulums. The pendulum's movement was proportional to pressure. Bomford confirmed that pressure, at that time, was greatest at the breech, and, based on his pressure curves, gun barrels, in 1844, started to be designed of varying thickness.
In 1847, the "Father of Naval Ordnance", a U.S. Navy lieutenant, examined naval requirements, and decided that to meet tactical requirements, larger shells, which could be driven with higher pressure, were necessary. His 1847 design for a 9-inch cannon adopted a "bottle shape" for the barrel, using the least weight for the predicted pressures. Continuing his research, he concluded that the largest shell that could be handled by the manual means in use would weigh 135 pounds, which he designed as an 11-inch projectile. The Navy resisted his 11-inch design, but ordered a number of 9-inchers in 1854. 
Naval warfare began to push improvements, including rifled, higher-velocity, longer-range cannon to overcome "ironclad" armor. As indirect fire became practical, first on land and then at sea, there was greater demand for longer barrels, which needed both higher-pressure, and later controlled-pressure, propellants.
In the 1880s brown or cocoa powder made from under-burnt charcoal was adopted as one means of decreasing the burning rate by the Germans. Made from rice straw, the grains were made in single, perforated hexagonal or octagonal prisms. It was of higher quality, but was more sensitive to friction than black powder. A serious drawback of these gunpowders was that only about half of the mixture was converted into gas, the remainder becoming a dense smoke. Smoke obscured targets and made aiming difficult. While smokeless powder is not free of smoke, it produces much less than black powder.
The French, in 1886, adopted smokeless powder made of nitrocellulose (gun-cotton). Four years later, the Royal Navy began using smokeless powder made from a nitroglycerine base. Both these compounds liberated four to five times as much energy as did the black powder used earlier. In addition, these materials could be formed readily into grains so shaped as to control the rate of burning. This gave a uniform pressure, permitting a higher projectile velocity without straining the gun. At the close of the 19th century, the U.S. Navy followed the lead of the French and adopted a nitrocellulose powder as a propellant charge. Black powder still continued in use as a burster charge for projectiles until just before World War I, when more powerful and less sensitive explosives were adopted.
Triple-base propellants are especially low flame, but, as can be seen in the illustration of WWII gunnery, they are not flashless. Flash became more of a problem. Especially at night, but to some extent against large cannon in the daytime, counterbattery fire could identify firing positions to be targeted, using techniques developed by the Canadian Army in the First World War. In World War II night engagements, flash temporarily blinded the ships' crews, as well as giving away the location of the gun and the ship mounting it. With the advent of radar, smoke became much less of a problem than flash.
Various flash suppressors were devised and mixed with the powder, which was formed into grains for small guns and into pellets for the larger guns. The British used a multiple-based powder, Cordite N, which was relatively flash-free, but which the U.S. Navy considered to be brittle, unduly sensitive to shock, and hazardous in hot climates. 
As a result the United States developed other flashless powders and was placing one of them, Albanite, in large scale production at the end of World War II. It is a triple-base propellant with no nitroglycerin, but 20.0% nitrocellulose (12.6% N), 19.5% DINA (propellant) (a substitute for nitroglycerin), 55.0% nitroguanidine, and the plasticizers 4.0% dibutyl phthalate and 1.5% centralite.)
By the Second World War, gunpowder was no longer used as a shell or bomb main charge, but smokeless powder remains the standard propellant class today for small arms.
Artillery, however, has been changing from late WWII. The U.S. Navy, in the 1950s, returned to a single-based propellant called Navy Cool (NACO). NACO is formulated in a different manner than traditional single-base propellants, but, in the long term, fails to meet the onboard safety requirements of the insensitive high explosives program. A new family called NILE is replacing it, and also in Army howitzers. 
- Military Explosives, U.S. Department of the Army, September 1984, TM 9-1300-214, pp. 9-5 to 9-11
- History of DuPont & the Government, DuPont
- Halbers Powell Gillette (1904), Rock excavation: methods and cost, M.C. Clark, pp. 106-108
- Carl D. Park (2007), Ironclad down: the USS Merrimack-CSS Virginia from construction to destruction, Naval Institute Press, pp. 112-114
- Military Explosives, p. 2-7
- Christine M. Michienzi, Carl J. Campagnuolo, Edward G. Tersine, Christine D. Knott, William J. Andrews, IM Solutions For Projectiles Crimped to Cartridges for Artillery Application - Phase II, Transition from Cartridge Case Venting to Insensitive Propellant, U.S. Navy
- James Ripley (September 2003), "Armed with ERGM, Navy gun fire is fast and deadly", Sea Power