When a gun is fired, it stamps its signature onto the bullet and the cartridge case in the fractions of a second they spend inside it. Firearms examination is the discipline of reading those marks — and it works on two levels: class characteristics and individual characteristics.
Class characteristics narrow the field
The inside of a barrel is cut with spiral grooves — rifling — that spin the bullet for accuracy. Rifling leaves lands and grooves on the bullet, and the number, width, and direction (left or right twist) are class characteristics: they're shared by every gun of that make and model. They can't identify a single weapon, but they can say a bullet is consistent with — or excluded from — a class of firearms.
Individual characteristics identify the weapon
No two barrels are microscopically identical. Tiny imperfections from manufacture and wear scratch fine, random striations onto each bullet that passes through. Examiners compare a crime bullet against a test bullet fired from a suspect weapon using a comparison microscope — two microscopes joined so both can be viewed side by side — looking for striations that line up.
Cartridge cases carry their own marks: the firing pin impression, breech-face marks, and extractor/ejector marks, all left as the round is fired and ejected. These can link cases to a specific gun, and to each other across scenes.
Databases and cold links
National systems such as NIBIN (using IBIS technology) store images of marks from cases and bullets, letting investigators find links between shootings — a gun used in one crime tied to another — even before a weapon is recovered.
An honest note on certainty
Firearms identification has faced serious scientific scrutiny. The core methods are well established, but the traditional claim of a match to the exclusion of all other firearms has been challenged, and examiners increasingly express conclusions with appropriate caution. Understanding both the power and the limits of the method is part of doing it properly.