In early, black powder guns such as muzzleloaders, the primer was essentially the same chemical as the main propellant (albeit usually in a finer-powdered form), but poured into an external flash pan, where it could be ignited by an ignition source such as a slow match or a flintlock. This external powder was connected through a small opening at the rear of the gun barrel that led to the main charge within the barrel, as gunpowder will not burn when wet, this made it difficult (or even impossible) to fire these types of weapons in rainy or humid conditions.
Modern primers by contrast are more specialized and distinct from the main propellant they are designed to ignite. They are of two types, those using shock-sensitive chemicals, and those reliant on chemicals ignited by an electric impulse; in smaller weapons the primer is usually of the first type, and integrated into the base of a cartridge. Examples include handgun cartridges, rifle cartridges and shotgun shells. Larger artillery pieces in contrast typically use electric priming. In artillery the primers are frequently a separate component, placed inside the barrel to the rear of the main propellant charge -- but there are other examples of guns, including for example some automatic weapons, designed to shoot cartridges with integral electric primers.
Upon being struck with sufficient force generated by the firing pin, or electrically ignited, primers react chemically to produce heat, which gets transferred to the main propellant charge and ignites it, and this in turn propels the projectile. Due to their small size, these primers themselves lack the power to shoot the projectile, but still have enough energy to drive a bullet partway into the barrel — a dangerous condition called a squib load.
The first step to firing a firearm of any sort is igniting the propellant, the earliest firearms were hand cannons, which were simple closed tubes. There was a small aperture, the "touchhole", drilled in the closed end of the tube, leading to the main powder charge, this hole was filled with finely ground powder, which was then ignited with a hot ember or torch. With the advent of hand-held firearms, this became an undesirable way of firing a gun. Holding a burning stick while trying to pour a charge of black powder carefully down a barrel is dangerous, and trying to hold the gun with one hand while simultaneously aiming at the target and looking for the touchhole makes it very difficult to fire accurately.
The first attempt to make the process of firing a small arm easier was the "matchlock", the matchlock incorporated a "lock" (so called because of its resemblance to door locks of the day) that was actuated by a trigger, originally called a "tricker." The lock was a simple lever which pivoted when pulled, and lowered the match down to the touchhole. The match was a slow burning fuse made of plant fibers that were soaked in a solution of nitrates, charcoal, and sulfur, and dried. This "slow-match" was ignited before the gun was needed, and it would slowly burn, keeping a hot ember at the burning end, after the gun was loaded and the touchhole primed with powder, the burning tip of the match was positioned so that the lock would bring it into contact with the touchhole. To fire the gun, it was aimed and the trigger pulled, this brought the match down to the touchhole, igniting the powder. With careful attention the slow-burning match could be kept burning for long periods of time, and the use of the lock mechanism made fairly accurate fire possible.
The next revolution in ignition technology was the "wheel-lock", it used a spring-loaded, serrated steel wheel which rubbed against a piece of iron pyrite, similar to a modern lighter. A key was used to wind the wheel and put the spring under tension. Once tensioned, the wheel was held in place by a trigger. When the trigger was pulled, the serrated edge of the steel rubbed against the pyrite, generating sparks, these sparks were directed into a pan, called the "flash pan", filled with loose powder which led into the touchhole. The flashpan usually was protected by a spring-loaded cover that would slide out of the way when the trigger was pulled, exposing the powder to the sparks, the wheel-lock was a major innovation — since it did not rely on burning material as a source of heat, it could be kept ready for extended periods of time. The covered flashpan also provided some ability to withstand bad weather. Wind, rain, and wet weather would render a matchlock useless, but a wheel-lock that was loaded and waterproofed with a bit of grease around the flashpan could be fired under most conditions.
The wheel-lock enjoyed only a brief period of popularity before being superseded by a simpler, more robust design, the "flintlock", like the wheel-lock, used a flashpan and a spark to ignite the powder. As the name implies, the flintlock used flint rather than iron pyrite, the flint was held in a spring-loaded arm, called the "cock" from the resemblance of its motion to a pecking chicken. The cock rotated through approximately a 90 degree arc, and was held in the tensioned, or "cocked" position by a trigger. Usually, flintlocks could lock the cock in two positions, the "half-cock" position held the cock halfway back, and used a deep notch, so that pulling the trigger would not release the cock. Half-cock was a safety position, used when loading, storing or carrying a loaded flintlock, the "full-cock" position held the cock all the way back, and was the position from which the gun was fired. The L-shaped "frizzen" was the other half of the flintlock's ignition system, it served as both a flashpan cover and a steel striking surface for the flint. The frizzen was hinged and spring-loaded so that it would lock in the open or closed position. When closed, the striking surface was positioned so that the flint would strike at the proper angle to generate a spark, the striking flint would also open the frizzen, exposing the flashpan to the spark. The flintlock mechanism was simpler and stronger than the wheel-lock, and the flint and steel provided a good, reliable source of ignition, the flintlock remained in military service for over 200 years, and flintlocks are still made today for historical re-enactments and muzzle-loading target competition, and for hunters who enjoy the additional challenge that the flintlock provides.
The next major leap in ignition technology was the invention of the chemical primer, or "cap", and the mechanism which used it, called the "caplock". Percussion ignition was invented by Scottish clergyman Rev. Alexander John Forsyth in 1807 but needed further refinements before it was gradually accepted in the 1820s to 1830s. By the middle of the 19th century the percussion or caplock system was well established, it was adopted by both sides in the American Civil War, as it was simpler and more reliable than the flintlock. The main reason the caplock was so quickly adopted was its similarity to the flintlock and the ease of converting older arms to use percussion-cap ignition; usually the same lock and barrel could be used with minor changes. The flashpan and frizzen were removed and replaced by a small, hollow horizontal cylinder (drum) screwed into the bored-out and tapped flash hole and carrying a "nipple" over which the cap could be fitted. A "hammer" which also had half-cock (for loading and applying the cap) and full-cock positions replaced the cock. When released by pulling the trigger, the hammer would strike the cap, crushing it against the nipple, the percussion cap was a thin metal cup that contained a small quantity of pressure-sensitive explosive, often mercury fulminate. When crushed, the explosive would detonate, sending a stream of hot gas down through a hole in the nipple and into the touchhole of the gun to ignite the powder charge; in the process of firing, the cap generally split open and would fall off when the hammer was moved to half-cock position for loading. The caplock system worked well, and is still the preferred method of ignition for hunters and recreational shooters who use muzzle-loading arms.
A small number of caseless cartridges use no primer at all, but the primary propellant is ignited using an externally provided electric charge, such as with the Voere VEC-91 and the O'Dwyer VLe, this is not to be confused with an electrically ignited internal primer (see below).
Chemical primers, advanced metallurgy and manufacturing techniques all came together in the 19th century to create an entirely new class of firearm — the cartridge arm. Flintlock and caplock shooters had long carried their ammunition in paper cartridges, which served to hold a measured charge of powder and a bullet in one convenient package; the paper also served to seal the bullet in the bore. Still, the source of ignition was handled separately from the cartridge, with the advent of chemical primers, it was not long before several systems were invented with many different ways of combining bullet, powder, and primer into a single package which could be loaded quickly from the breech of the firearm. This greatly streamlined the reloading procedure and paved the way for semi- and fully automatic firearms.
This big leap forward came at a price, it introduced an extra component into each round – the cartridge case - which had to be removed before the gun could be reloaded. While a flintlock, for example, is immediately ready to be reloaded once it has been fired, adopting brass cartridge cases brought in the problems of extraction and ejection, the mechanism of a modern gun not only must load and fire the piece, but also must remove the spent case, which may require just as many moving parts. Probably most malfunctions involve this process, either through failure to extract a case properly from the chamber or by allowing it to jam the action. Nineteenth-century inventors were reluctant to accept this added complication and experimented with a variety of self-consuming cartridges before acknowledging that the advantages of brass cases far outweighed their one drawback.
A pinfire firearm cartridge is an obsolete type of brass cartridge in which the priming compound is ignited by striking a small pin which protrudes radially from just above the base of the cartridge. Invented by Casimir Lefaucheaux in 1828 but not patented until 1835, it was one of the earliest practical designs of metallic cartridge. However, the protruding pin was vulnerable to damage, displacement and accidental ignition. Moreover, the pin had to be positioned carefully in a small notch when loading, making the pinfire's use in repeating or self-loading weapons impossible, the pinfire survives today only in a few very small blank cartridges designed as noisemakers and in novelty miniature guns.
Rimfire cartridges use a thin brass case with a hollow bulge, or rim, around the back end, this rim is filled during manufacture with an impact-sensitive primer. In the wet state, the primer is stable; a pellet of wet primer is placed in the shell and simply spun out to the full extremes of the rim. (For more on the exact process and one set of chemical compounds that have been used successfully, see U.S. Patent 1,880,235, a 1932 Remington Arms patent by James E. Burns.) In the dry state, the primer within the rim becomes impact-sensitive. When the rim is then crushed by the hammer or firing pin, the primer detonates and ignites the powder charge. Rimfire cartridges are single-use and normally cannot be reloaded. Also, since the rim must be thin enough to be easily crushed, the peak pressure possible in the case is limited by the strength of this thin rim. Rimfire cartridges originally were available in calibers up to 1" (100 caliber), however, all but the small .22 caliber rounds eventually died out. The .22 Long Rifle, also fired in pistols, is the most popular recreational caliber today because it is inexpensive, quiet, and has very low recoil.
While the rimfire priming method is limited due to the thin cases required, it has enjoyed a few resurgences recently. First was Winchester's .22 Magnum Rimfire, or .22 WMR, in the 1950s, followed in 1970 by Remington's short-lived 5mm Rimfire, based on Winchester's magnum case. In 2002 Hornady introduced a new .17 caliber cartridge based on the .22 WMR, the .17 HMR. The .17 HMR is essentially a .22 WMR cartridge necked down to accept a .17-caliber bullet, and is used as a flat-shooting, light-duty varmint round. The .17 HMR was followed a year later by Hornady's .17 Mach 2, or .17 HM2, which is based on a slightly lengthened and necked-down .22 Long Rifle cartridge. Both of the .17 caliber rimfires have had widespread support from firearms makers, and while the high-tech, high-velocity .17 caliber jacketed bullets make the .17 Rimfire cartridges quite a bit more expensive than the .22 caliber versions, they are excellent for shorter-range shooting and still far less expensive than comparable centerfire cartridges. In 2013, Winchester released the .17 Winchester Super Magnum, which utilizes the larger case of the long-obsolete .25 Stevens allowing for velocities approaching 3000fps with a 20gr bullet and making it the world's fastest rimfire round.
The identifying feature of centerfire ammunition is the metal cup containing the primer inserted into a recess in the center of the base of the cartridge, the firearm firing pin crushes this explosive between the cup and an anvil to produce hot gas and a shower of incandescent particles to ignite the powder charge. Berdan and Boxer primers are used in centerfire cartridges; the primers differ in construction. Various priming mixtures have been used in different sized primers to effect prompt ignition of the powder charge. Particles with relatively high heat capacity are required to promptly ignite smokeless powder deterrent coatings, some priming explosives decompose into incandescent solids or liquids. Inert ingredients may be heated into incandescent sparks when the explosive decomposes into gas. Cartridges for military use require stable priming formulations so war reserves of small-arms ammunition will dependably function after years of storage.
Some rapid-fire, and larger military gun and autocannon rounds (such as the M50 20mm) utilize an internal electric primer that contains chemicals activated by an externally provided electric charge, as opposed to a mechanical impact, the primer in turn ignites the main propellant, just as with a shock-sensitive or external electric type. Among the advantages this brings is the ability, in an automatic weapon, to control the moment of cartridge ignition partially independently of the mechanical action of the gun. Historically this quality was employed by the German Luftwaffe in WW II, in the unusually efficient synchronization gear that enabled machine guns and autocannon to be fired through the moving propellors of their fighter aircraft. Other countries such as the Soviet Union relied on crude mechanical systems, which reduced the rate of fire of their guns more severely. 
- John B. Snow, "Ammo Review: New .17 Winchester Super Magnum, World's Fastest Rimfire Round", Outdoor Life
- Davis, William C., Jr. Handloading (1981) National Rifle Association p.65
- Davis, William C., Jr. Handloading (1981) National Rifle Association p.21
- "WORLD WAR 2 FIGHTER GUN EFFECTIVENESS". www.quarryhs.co.uk.
- Siekman, Mark W.; Anderson, David A.; Boyce, Allan S. (September–October 2010), "Small-Arms Ammunition Production and Acquisition: Too Many Eggs in One Basket?", Professional Bulletin of United States Army Sustainment, U.S. Army, 42 (5), PB 700-10-05. Thirteen chemicals used in U.S. Army small arms cartridges; 7 chemicals are not available within the U.S.
- U.S. Army (September 1984), Military Explosives, Technical Manual, Department of the Army, TM 9-1300-214, p. 2-3 stating "1602–1604. Fulminating gold, later used as a priming explosive, was invented by Johann Tholden, a Dutch chemist in the employ of the British Navy." Later, on same page, "1628. Gold fulminate priming explosives for torpedoes were invented by J. Thollen for the British Navy."
- Urbański, Tadeusz; Jurecki, Marian (translator) (1967), Laverton, Sylvia, ed., Chemistry and Technology of Explosives, III (First English ed.), Pergammon, LCCN 63-10077 c.f. p. 129. Basilius Valentinus described "explosive gold" in first half of 17th century. In 1630, Van Drebbel (Cornelis Drebbel?) investigated fulminate of mercury and "explosive gold". In 1690, Johann von Löwenstern-Kunckel's book Laboratorium Chymicum described how to make fulminate of mercury; in 1805, Alexander John Forsyth used potassium chlorate to make pellets, but these were not safe. "The first ignition caps were invented in the early nineteenth century. In these caps the ignitable composition was enclosed in a casing of brass or copper, this invention cannot be traced with any certainty to any individual. The literature on the subject names several chemists including Bellot and Egg in 1815 , the first application of mercury fulminate in ignition caps is attributed to Wright in 1823."