Pick up almost anything from a supermarket shelf.
A packet of biscuits, a bottle of shampoo, or a box of cereal.
Somewhere on the packaging, you will probably find a familiar pattern:
Black and white lines.
A cashier scans them, and almost instantly the computer knows which product you are buying.
But have you ever wondered:
Why do barcodes use black and white lines?
Why not numbers alone? And what information is actually hidden inside those lines?
The answer begins with a supermarket problem that engineers started trying to solve more than 75 years ago.
1. Supermarkets Needed a Faster Checkout System
In the late 1940s, supermarkets were becoming larger and carrying more products.
Cashiers had to manually identify items and enter their prices.
A graduate student named Bernard Silver learned that a supermarket executive was looking for a way to automatically identify products at checkout.
Silver discussed the problem with his friend Norman Joseph Woodland.
They began developing a machine-readable product identification system.
In 1952, they received a U.S. patent for their invention.
2. The Original Barcode Wasn't Rectangular
Woodland reportedly drew inspiration from Morse code.
He extended dots and dashes into lines that a machine could recognize.
One of their early designs was actually circular, sometimes called a bull's-eye barcode.
The advantage was that it could theoretically be scanned from different directions.
However, the technology required to make barcodes commercially practical was still developing.
3. Why Black and White?
The answer comes down to contrast.
Traditional barcode scanners shine light across the barcode.
The two areas interact with that light differently:
White spaces reflect more light.
Black bars reflect much less light.
A sensor detects these changes in reflected light and converts them into an electrical signal.
The computer then interprets the pattern.
Black and white provide strong contrast, making the code relatively easy and reliable for optical scanners to read.
4. The Width of the Lines Matters
A barcode is not simply a random collection of black lines.
Both the bars and spaces, along with their widths and positions, encode information.
In a standard retail UPC barcode, patterns represent numbers.
Those numbers identify things such as the company and specific product according to the coding system being used.
Importantly, the barcode usually does not contain the product's price.
Instead, the scanned identification number is used to look up the product in the retailer's database, where information such as its current price is stored.
That is why a store can change a price without printing a completely new barcode.
5. Why Are Numbers Printed Underneath?
Look underneath many barcodes and you will see the numerical code printed as well.
Why include it if the scanner reads the bars?
Because machines sometimes fail.
A barcode might be:
Damaged
Wrinkled
Poorly printed
Partially covered
If the scanner cannot read it, the cashier can manually enter the numbers.
It is a simple backup system.
6. The First UPC Scan Made History
On June 26, 1974, one of the most famous moments in retail technology occurred at a supermarket in Troy, Ohio.
A pack of Wrigley's Juicy Fruit chewing gum became the first product scanned using the new Universal Product Code system at a supermarket checkout.
That pack of gum is now part of the collection of the Smithsonian Institution.
What looked like a small improvement to checkout would eventually transform global retail.
7. Barcodes Quietly Run Much More Than Supermarkets
Today, barcodes are used for far more than buying groceries.
They help organizations:
Track packages
Manage warehouses
Identify hospital supplies
Organize library books
Track manufacturing components
Manage airline baggage
More advanced systems such as QR codes can store much more information, but the basic barcode remains one of the simplest and most successful identification technologies ever created.
A Few Lines That Changed Global Commerce
The next time you hear the familiar beep at a supermarket checkout, look at the tiny pattern that made it possible.
Those black and white lines are not decoration.
They create an optical pattern that machines can quickly translate into an identification number.
An idea inspired partly by Morse code eventually became a universal language between physical products and computers.
And billions of times every day, those simple lines quietly keep global commerce moving.
Frequently Asked Questions
Why are barcodes black and white?
Black and white create strong optical contrast. Traditional scanners detect differences in reflected light to read the pattern.
Does a barcode contain the price?
Usually, no. Retail barcodes identify the product. The store's computer uses that identification number to retrieve information such as the current price.
Who invented the barcode?
Norman Joseph Woodland and Bernard Silver developed an early barcode system and received a patent in 1952.
What was the first product scanned with a UPC barcode?
A pack of Wrigley's Juicy Fruit chewing gum was scanned at a supermarket in Troy, Ohio, on June 26, 1974.
Stay Curious
If you enjoy discovering the hidden stories behind everyday technology, products, and designs, subscribe to The Turning Pages Newsletter.
You will receive mind boggling origin stories about the objects, systems, and inventions we encounter every day but rarely stop to question.
Because once you start noticing these details, you will realise something fascinating.
The world is full of stories hiding in plain sight
