Who’s exploring?

DISCOVER · ARTICLE

How Barcodes Talk to Computers

Those black stripes are a font that machines can read at the speed of a beep — and the last digit is a built-in lie detector.

A green computer motherboard close-up

Stripes that are really numbers

A standard product barcode, the UPC, encodes twelve digits. The black bars and white spaces come in different widths, and the scanner reads the pattern of widths as a sequence of numbers — the bars are the digits, written in a machine-readable font.

Importantly, the barcode usually does not contain the price. It contains an identifying number, and the shop's computer looks that number up in a database to find the name and current price. Change the price in the database, and every item updates at once.

The first scan and the checkout beep

The barcode idea was patented in 1952, inspired in part by Morse code stretched into lines. It took lasers and cheaper computers to make it practical, and the first product scanned in a shop — a pack of chewing gum in Ohio — was in 1974.

That beep you hear is not the sound of the price being found. It is simply the scanner confirming it read the code successfully, so the cashier knows the item registered.

The clever last digit

The twelfth digit of a UPC is a check digit. The scanner's computer does a small calculation with the other eleven digits and compares the answer with the check digit. If they do not match, the code was probably misread and the scan is rejected.

It is a tiny piece of built-in self-checking, the same basic idea — add a number whose only job is to catch errors — that appears in bank cards, book ISBNs, and many other codes.

Keep reading? Spark picked your next article.

The Bicycle: The Simple Invention That Set People FreeMore about Inventions

More in Computing

— forget which articles you’ve read on this device.

Sources, credits & transparency

Development reference photograph · Unsplash. Reference use; provenance and final image approval pending; see public/images/manifest.json.

Created with AI assistance as part of a bulk seed pack approved by the SparkKindly site owner on 15 November 2026. No independent specialist review is claimed.

Report a mistake on this page