The Cotton gin is a machine invented in 1793 by American Eli Whitney to automate the production of cotton fiber. The machine quickly and easily separates the cotton fibers from the seedpods and the sometimes sticky seeds. It uses a combination of a wire screen and small wire hooks to pull the cotton through the screen, while brushes continuously remove the loose cotton lint to prevent jams.

The traditional account of Whitney's invention of the gin tells of his being inspired by the sight of a cat clawing a chicken through the slatted walls of its coop and retrieving a paw full of feathers.

Small cotton gins were hand-powered; larger ones were harnessed to horses or water wheels.

The cotton gin revolutionised the cotton-growing industry because it vastly increased the quantity of cotton that could be processed in a day. This made the widespread raising of cotton profitable in the American South, and is often considered to have greatly increased the demand for slave labor.

The word gin in "cotton gin" is unrelated to the drink called gin; it is related to the word engine and means "device".