In breechloading firearms, an extractor is an action component that serves to remove spent casings of previously fired cartridges from the chamber, in order to vacate the chamber for loading a fresh round of ammunition.
In repeating firearms with moving bolts, the extractor is often one or a set of hook-like flanges on the bolt head that grab onto the casing's rim, so when the bolt moves rearwards the casing is pulled out of the chamber. It is typically aided by a protruding ejector in the receiver or the bolt, which provides an opposite counter-push that couples with the extractor pull to expel the casing entirely out of the gun.
In modern dropping block, break-action (e.g. double-barrel shotguns) and revolver firearms, the extractor is a protrusible piece with flanges on the barrel/cylinder side, which pushes rearwards on the casing's rim and slides it out of the chambers. Some such extractors can push hard and far enough that they completely clear the cases out of the gun, thereby also performing the function of an ejector.
Extractors are a hallmark feature of repeating firearms, and can be found on bolt-action, lever-action, pump-action, semi-automatic, and fully automatic firearms. Extractors are also found on revolvers, removing cases either in succession (as in a fixed-cylinder single-action revolver) or simultaneously (as in a double-action revolver with a swing-out or top-break cylinder). For rimmed cases, the protruded rim serves as the grabbing point from which the extractor works. For rimless cases, the groove at the base serves as the grabbing point from which the extractor works.
Not all single-shot firearms have extractors, though many do. Break-action shotguns, double rifles, and combination guns typically have an extractor that push out the casings when the action is flexed open. Most modern extractors are forceful enough to completely eject the casing from the gun (i.e. integrating the function of an ejector), but some require the user to manually remove spent cartridges. In this situation, the extractor loosens and moves the case out of the chamber just far enough to allow the user to grab and pull out the casing, but not far enough to remove the case entirely from the chamber. This situation is encountered on some single-shot rifles, single-shot pistols (such as the break-action Thompson/Center Contender), and on some break-action single- and double-barrel shotguns.
In bolt-action, lever-action, pump-action, semi-automatic, and fully automatic firearms, the extractor typically work in conjunction with a separate ejector to remove completely a fired, empty cartridge case from the weapon. The extractor moves with the bolt to pull the cartridge case rearwards out of the chamber, and at some point the ejector eccentrically exerts a frontal push (from the case's frame of reference), which torques and "flicks" the case out of a side opening on the receiver known as the ejector port.
Some very early blowback pistols used ammunition with no rim or extractor groove on the cartridge cases (e.g., 5mm Bergmann), and such pistols therefore lacked extractors. The spent case was forced out of the chamber by recoil, and was subsequently ejected. As this system did not provide for easy clearance of misfires, it was not very successful, especially for self-defense handguns needing to be cleared quickly and reloaded in the event of a cartridge primer malfunction. Nonetheless, there are examples of contemporary modern semi-automatic pistols that do not have extractors even to this day, such as the Beretta Bobcat, Beretta Model 21A, and clones of the Beretta designs such as the Taurus PT22 that are successful. These modern pistols typically have flip-up barrels, to permit easy loading without necessarily cycling a slide against a strong recoil spring, making these pistols suitable for use by people with minimal hand strength. The trade made is that in the event of a cartridge primer malfunction, the gun is rendered useless until the action can be cycled by someone with full hand strength. Still, for someone without the hand strength to handle a semi-automatic firearm with a slide against a strong recoil spring, the trade is often made.
An extractor also performs the function of an ejector in revolvers. When the striking force applied to the ejector rod is hard and fast enough, the extractor will typically eject the empty case(s) from the cylinder. Some break-action shotguns are also designed to eject empty shells completely out of the chamber when the barrel is opened.