How Do Barcodes Work? (2026)

the barcode and a person figure sitting on a chair on a light green background

How do barcodes work? They encode numbers as a printed pattern of bars and spaces of varying widths. A scanner shines light across the symbol, measures the reflection, and converts the pattern into digits. Those digits act as a database key — the price, product name, and stock level live in software, not on the label.

What Is a Barcode?

A barcode is a machine-readable label that encodes a short number (or short string) using a printed pattern of bars and spaces. The symbol carries the key, not the data. The actual product information lives in the database the scanner is connected to.

Every standard 1D barcode has three parts you can see:

The bars and spaces: Black bars and white spaces of varying widths. Each character in the encoded number maps to a specific pattern of widths.

The quiet zone: A blank margin on both sides of the symbol. Scanners need it to detect where the code begins. A printer trimming this margin is one of the most common reasons a label fails to scan.

The human-readable digits: The numbers printed below the bars. They exist as a fallback so a cashier can key the product in by hand if the symbol is damaged.

The label looks simple. The system around it isn't. A scanned UPC triggers a database lookup, a POS price refresh, and an inventory decrement, usually in under 100 milliseconds.

A barcode scanner reading a 1D linear barcode on a light purple background

A Brief History: From Sand to Wrigley's Gum

The barcode started as a beach drawing. In 1948, a Philadelphia food chain executive asked the Drexel Institute of Technology for help automating supermarket checkout. Two graduate students, Norman Joseph Woodland and Bernard Silver, took on the problem.

Woodland's first prototype used concentric circles — a "bullseye" pattern that could be read from any angle. He sketched the linear version while sitting on a Miami Beach, drawing four lines in the sand with his fingers. The idea borrowed directly from Morse code: dots and dashes, stretched downward into thin and wide bars.

Their 1952 patent described a label printed in ultraviolet-sensitive ink, read by a 500-watt incandescent bulb. The system worked, technically. It was also too hot, too expensive, and too unreliable to ship. The patent expired before anyone built a commercial product around it.

The first real scan happened on June 26, 1974, at a Marsh Supermarket in Troy, Ohio. The item was a 10-pack of Wrigley's Juicy Fruit chewing gum. That single pack is now in the Smithsonian. According to an NBER study, the rollout of barcode scanners increased a store's labor productivity, on average, by approximately 4.5 percent in the first few years.

💡
The Wrigley's gum pack sold for 67 cents. The scanner that read it cost the equivalent of about $20,000 in today's money. Adoption was slow until card-scanning POS hardware caught up in the 1980s.

How Do Barcodes Work? The Four-Step Mechanism

If you want to know how barcodes work end to end, the process breaks into four stages: encoding, storage, scanning, and decoding. Each stage is mechanical and unambiguous, which is why the system tolerates dust, low light, and worn labels far better than human data entry.

1. Encoding: From digits to bar widths

Every symbology — UPC-A, EAN-13, Code 39, Code 128 — has its own rulebook for turning a digit into a bar pattern. In UPC-A, each of the 12 digits is built from two bars and two spaces, drawn from a fixed table. The digit 6, for example, is encoded as a thin space, a thin bar, a wide space, a wide bar in the left half of the symbol — and as the opposite pattern in the right half. That left/right mirroring is what lets the scanner know which way the label is oriented.

2. Storage: What the label actually carries

The label holds the key, not the record. A 12-digit UPC contains roughly 20 characters of data in a 1D format. The price tag, ingredient list, and stock level live in the retailer's database. The barcode's only job is to point at the right row.

2D codes flip this. A QR code can hold up to about 7,000 numeric characters or 4,300 alphanumeric characters inside the symbol itself. That's enough for a full URL, a Wi-Fi password, or a vCard, without a database hit.

3. Scanning: Light in, signal out

A scanner emits red light — laser, LED, or both — across the symbol. Black bars absorb the light. White spaces reflect it. The reflected pattern hits a photodiode or image sensor, which converts the brightness sweep into an analog electrical waveform. Tall spikes mean a wide white space. Short spikes mean a thin bar.

4. Decoding: From signal back to digits

The scanner's firmware measures the time between transitions in that waveform and reconstructs the original bar widths. It matches the widths against the symbology's table, recovers the digits, validates them against the check digit, and ships the resulting number to the POS or inventory system over USB, Bluetooth, or a wedge connection. The whole chain — light to digits to database lookup — usually completes in under a tenth of a second.

How Do Barcodes Store Information?

1D and 2D barcodes store information in completely different ways. The difference matters because it dictates what you can put on a label and how the scanner has to read it.

A 1D barcode visualizing how product information is stored and linked to store databases

1D barcodes: positional encoding

A 1D barcode is read left to right, like a sentence. Each character is a position. The width of the bars and spaces at that position determines the value. Because the data is linear, capacity is capped — a UPC-A symbol holds 12 digits, an EAN-13 holds 13, and a Code 128 can stretch to around 80 characters before the label gets unreadable at retail print sizes.

2D barcodes: matrix encoding

A 2D barcode is a grid of small squares (called modules) that the scanner reads as a two-dimensional bitmap. Data is encoded in both axes, which is why a QR code the size of a postage stamp can hold a few thousand characters. 2D symbols also build in Reed-Solomon error correction, so a code with up to 30% of its surface scratched out can still decode.

The capacity gap is roughly 20 characters versus 7,000. That's the whole reason airline boarding passes, parcel labels, and pharma serialization moved to 2D — there's no way to fit a globally unique serial number plus a batch and expiry date inside a linear bar pattern.

1D vs 2D Barcodes

The choice between linear and matrix codes comes down to capacity, scanner cost, and reading speed. Here's the short version.

Dimension1D (Linear)2D (Matrix)
Reading directionHorizontal onlyBoth axes
Capacity~20 charactersUp to ~7,000 characters
Scanner neededLaser or CCDCamera-based imager
Common formatsUPC-A, EAN-13, Code 39, Code 128QR Code, Data Matrix, PDF417, Aztec
Error correctionSingle check digitReed-Solomon (up to 30%)
Typical useRetail SKUs, books, shippingBoarding passes, mobile payments, pharma

For a deeper feature-by-feature breakdown, QR codes vs. barcodes covers the trade-offs in detail.

How Does a Barcode Scanner Work?

Four scanner types dominate the market in 2026, and the choice usually comes down to surface conditions, scan distance, and budget. Most readers fall into one of these categories.

Laser scanners: A spinning mirror sweeps a red laser line across the symbol. Fast, accurate at distance, and almost immune to ambient light. They only read 1D codes, which is why they're being phased out of retail in favor of imagers.

CCD readers: A linear array of tiny light sensors captures the brightness gradient across the bar pattern in a single shot. No moving parts, cheaper than laser, but limited range — usually under 4 inches.

2D imagers: A camera takes a still photo of the symbol and software decodes it. Imagers read 1D and 2D, omnidirectionally (you don't have to align the code), and shrug off label damage. This is the format that handheld retail and warehouse scanners standardized on starting around 2018.

Smartphone cameras: The same underlying technology as 2D imagers, but consumer-grade. Modern iPhones and Pixels can decode UPCs and QR codes natively from the camera app, with no third-party scanner needed.

Picking a scanner is mostly about throughput. A grocery POS lane that handles 20 items a minute needs something with predictable acquisition speed under fluorescent lighting. A pharmacy receiving dock unboxing 2D-coded vials needs imager-grade tolerance for crumpled labels. The barcode reader tool covers the basics for browser-based decoding if you don't have hardware on hand.

A smartphone scanning a barcode using the built-in camera app

The Data Inside a UPC

The 12 digits on a typical North American product barcode aren't random. They follow a strict GS1 structure that lets any retailer in the world identify the manufacturer and product without prior agreement.

Digit 1 (number system): Tells the scanner what kind of item this is. 0, 1, 6, 7, 8 are standard retail products. 2 is for variable-weight items like meat or produce. 3 is for drugs and health products. 4 is for loyalty cards. 5 and 9 are for coupons.

Digits 2-6 (manufacturer code): A unique five-digit prefix assigned by GS1 to the company that owns the product. Coca-Cola, P&G, and Nestle each have their own. The prefix never changes once issued.

Digits 7-11 (product code): The manufacturer assigns this to each individual SKU — say, a 12oz can of Diet Coke versus a 16oz bottle. Same prefix, different product code.

Digit 12 (check digit): Calculated from the other 11 digits using a fixed formula. If the scanner reads the first 11 digits and the check digit doesn't match, the scan is rejected and the cashier hears a buzz instead of a beep.

This structure is why a Diet Coke purchased in Portland and one in Pittsburgh ring up under the same identifier — and also why 90% of major retailers rely on barcodes for inventory and sales systems and why over 10 billion GS1 barcodes are scanned daily worldwide.

Why Barcodes Still Matter in 2026

I cover QR codes and adjacent identification tech full-time, and the easy take is that QR has eaten the world. The numbers say something more interesting. Barcodes haven't been replaced — they've been promoted from the only data-capture method to one layer in a bigger stack. They're still the dominant identifier in supermarkets, warehouses, libraries, and hospitals because they get three things right that nothing has fully displaced.

A barcode being scanned at a supermarket checkout for fast, accurate product identification

Accuracy is in a different league than human entry. According to Finale Inventory, manual data entry typically has a 1-in-300 error rate, while barcode scanning boasts a 1-in-3,000,000 accuracy rate — a 10,000x improvement. That gap is the entire reason hospitals scan wristbands before administering medication and why warehouses don't trust eyes-only counts.

Operational savings compound. A study in RSIS International reports that the transition led to an 80% improvement in inventory accuracy, a 20% reduction in operating costs. Those aren't marketing numbers — they're warehouse floor measurements.

2D upgrades the same workflow without breaking it. Finale's analysis notes that scanning accuracy improves dramatically with 2D codes, reducing pick errors by up to 30% in warehouse operations. Retailers don't have to rip out infrastructure to get the gain — they just swap laser readers for imagers.

Mobile scanning closes the productivity loop. In a Scandit retail group case study, store associates using smartphone-based scanning saw a 50% time saving for price and promotion label verification and a 20% improvement in on-shelf availability. Same barcodes, better device.

Barcode Formats You'll Actually See

There are dozens of symbologies on paper, but a handful cover almost everything you'll encounter in the wild.

UPC-A: 12 digits. The default for retail products in the US and Canada. Found on basically every grocery item.

EAN-13: 13 digits. The international version of UPC-A. The first 2-3 digits identify the country of the GS1 office that issued the prefix.

Code 39: Alphanumeric, variable length. Common in automotive, defense, and ID badges. Self-checking, but bulky on the label.

Code 128: Compact, high-density, supports the full ASCII set. Standard for shipping labels, healthcare, and supply chain.

QR Code: The most common 2D format. Reads omnidirectionally, encodes URLs, payments, and free text.

Data Matrix: Small-footprint 2D, often used on circuit boards and pharma vials where space is tight.

If you're choosing a format for your own product or inventory system, the barcode types guide walks through the trade-offs in detail.

How to Read a Barcode Manually

You can decode a UPC-A by eye if you have to — say, for a damaged label where the digits printed below are still legible. The structure is fixed.

Find the 12-digit number under the bars. If it's missing, you can't decode manually. That's also why the human-readable line is part of the standard.

Read digit 1 — the number system. A 0 means standard retail. A 2 means variable weight (in-store priced). A 3 means drugs.

Read digits 2-6 — the manufacturer prefix. Look it up in the GS1 company database to confirm the brand.

Read digits 7-11 — the product code. Cross-reference with the manufacturer's SKU list.

Verify digit 12 — the check digit. Multiply the odd-positioned digits by 3, sum them with the even-positioned digits, take the result modulo 10, and subtract from 10. If the answer matches digit 12, the number is valid.

For a longer walkthrough including EAN-13 and 2D codes, the how to read a barcode guide goes step by step.

Common Barcode Issues and Fixes

Most "the scanner won't read this" complaints come down to a handful of physical problems. None of them require a new scanner.

Smudged or low-contrast print: Toner streaks, faded thermal labels, and ink-jet bleed all break the brightness contrast a scanner needs. Print at 600 DPI minimum, use solid black on white, and avoid colored backgrounds. Yellow on white is invisible to most red lasers.

Quiet zone violation: If the blank margin on either side of the symbol is less than 10 times the width of the narrowest bar, scanners can't lock onto the start character. Add white space. Don't crop labels to fit packaging.

Damaged scan area: Tears, creases, or shrink-wrap distortion across the bars stops 1D reads cold. 2D codes survive better thanks to Reed-Solomon error correction, but only up to about 30% damage.

Wrong size for the print medium: A barcode shrunk below its minimum X-dimension prints with bars that bleed together. The ideal barcode size guide covers the math; the short version is don't go below 80% magnification for retail UPCs.

Curved or glossy surface: Wraparound labels on cans and bottles, or glossy laminate, can reflect the laser back at the wrong angle. Use a matte finish and flatten the label area where possible.

The Barcode-to-QR-Code Transition

GS1's "Sunrise 2027" initiative is pushing global retailers to support 2D barcodes (mostly QR codes) at point of sale alongside traditional UPCs by the end of 2027. The goal isn't to retire the linear barcode — it's to extend it. A QR-based 2D code can carry the same UPC number plus a batch ID, expiry date, and a URL the shopper can scan with a phone.

The practical effect is that most retailers will run both formats in parallel for the foreseeable future. Linear scanners stay in service. New 2D-capable imagers go in next to them. Packaging carries both symbols, sometimes overlapping, until the legacy hardware ages out.

For consumer-facing brands, the upgrade is more interesting than it sounds. A QR Code Dynamic code printed alongside a UPC turns every package into a marketing surface — a recipe link, a reorder shortcut, a loyalty enrollment — without changing how checkout works.

Frequently Asked Questions

How do barcodes store information?

1D barcodes store information positionally: each character is encoded as a fixed pattern of bar and space widths, read left to right. Capacity is capped at around 20 characters. 2D barcodes store data in a two-axis grid of modules, with built-in error correction, and can hold up to about 7,000 numeric characters in a single symbol.

How does a barcode scanner work?

A scanner shines red light (laser, LED, or camera-flash) across the symbol, measures how much reflects off white spaces versus how little reflects off black bars, and converts the resulting brightness pattern into an electrical signal. Firmware then reconstructs the original bar widths, matches them against the symbology's lookup table, verifies the check digit, and sends the decoded number to the POS or inventory system.

How do barcodes work in supermarkets?

At checkout, a laser or imager reads the UPC printed on each item. The decoded 12-digit number is sent to the POS, which looks up the product in the store's database to retrieve the price, name, and tax category. The system rings the item up, decrements inventory by one, and updates sales reporting — all in roughly 100 milliseconds per scan.

How to read a barcode manually?

Read the 12-digit number printed below the bars. Digit 1 is the number system (retail, variable weight, drugs). Digits 2-6 are the manufacturer prefix. Digits 7-11 are the product code. Digit 12 is the check digit, calculated from the first 11 using a fixed formula. If the check digit doesn't match the formula's output, the number is invalid.

When were barcodes first used in supermarkets?

The first commercial barcode scan happened on June 26, 1974, at a Marsh Supermarket in Troy, Ohio. The item was a 10-pack of Wrigley's Juicy Fruit chewing gum, and it sold for 67 cents. That gum pack is now in the collection of the Smithsonian's National Museum of American History.

From Wrigley's Gum to 10 Billion Daily Scans

A pattern Woodland sketched in beach sand in 1948 now moves products through every supermarket, warehouse, and hospital on the planet. The mechanism hasn't changed much — light hits a printed symbol, reflection becomes a digit, the digit looks up a record. What changed is what sits on either side of that lookup. Faster scanners, cheaper imagers, smartphone cameras in every pocket, and now 2D codes that carry their own payload.

If you're moving from linear-only to a mixed 1D/2D workflow, the practical first step is auditing your scanner fleet — anything bought before 2018 is probably laser-only and can't read QR. From there, picking a symbology comes down to what your downstream system expects. For consumer-facing extensions, generating dynamic, trackable 2D codes alongside your UPCs is where most of the upside lives. The barcode inventory system guide covers how the data flow works end to end.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to QR Code Generator: Free & No Sign-Up | QR Code Dynamic.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.