ANTBKnowledge
A barcode being scanned at a supermarket checkout

HOW THINGS WORK

How does a barcode store information?

Those familiar black stripes are not tiny pictures of a product. They are a compact visual language that lets scanners turn patterns of light and dark into numbers, identifiers and instructions for computer systems.

IllustrationFrom stripes to data Conceptual illustration of how a scanner interprets contrasting bars and spaces as digital data.

ANTB Knowledge DeskMelbourne
6 min read 6 sources
In this story
  1. A barcode is a translation, not a picture
  2. What the stripes on a supermarket product mean
  3. How a scanner reads the pattern
  4. Why the price is usually not inside the barcode
  5. What the digits are doing
  6. Why some barcodes are square
  7. Sources

A barcode is a translation, not a picture

A barcode is an optical, machine-readable representation of data. In a traditional linear barcode, the data appears as a sequence of bars and spaces arranged along one direction. In a two-dimensional barcode, such as a QR code, the information is arranged as a grid of contrasting cells. The visual pattern is governed by a barcode standard, which tells the scanner how to interpret the shapes and how to distinguish meaningful data from the surrounding blank space.

The bars and spaces are not intended to be read as ordinary letters or numbers by the human eye. They are a coded version of characters. Different barcode systems use different rules, so a scanner must know which symbology it is looking at before it can decode the pattern. UPC and EAN symbols, for example, are designed mainly for retail identification, while other GS1 symbols can carry attributes such as batch numbers, dates, serial numbers or measurements.

What the stripes on a supermarket product mean

The familiar barcode on a packet of food is commonly a UPC or EAN symbol. These are part of the GS1 system and are primarily used to represent a Global Trade Item Number, or GTIN. A GTIN identifies a particular trade item, such as a specific size and variety of a product. The same GTIN can be printed on many identical units, while a different product or package size receives a different number.

The number printed beneath the stripes is called the human-readable interpretation. It is a useful backup when the symbol is scratched, badly printed or otherwise impossible to scan. The printed number and the bars represent the same identifier, but they are presented in different forms: one is intended for people and the other for machines.

The parts of a retail barcode and its database connection
IllustrationAn identifier, not a price tag Conceptual illustration showing how a barcode number can connect a physical product to a retailer’s database.

How a scanner reads the pattern

A scanner works by detecting contrast. Traditional laser scanners sweep a beam of light across the barcode, while image-based readers capture a picture and analyse it. Dark bars absorb or reflect less light than the lighter spaces around them, creating a changing signal as the scanner passes across the symbol. The reader measures the widths and positions of these contrasting areas.

The barcode specification provides the decoding rules. The scanner identifies features such as the beginning and end of the symbol, the relative width of bars and spaces, and the character patterns represented by those widths. It then converts the visual pattern into a sequence of digits or other permitted characters. GS1 describes linear barcodes as using variable-width lines and spaces to encode data.

A symbol also needs enough clear space around it to be recognised reliably. This unprinted margin is commonly called a quiet zone. Strong contrast, suitable dimensions and accurate printing all help the scanner distinguish the barcode from packaging artwork. This is why the standard black-on-white design remains so dependable, even though some other colour combinations can work when they preserve sufficient contrast.

Comparison of linear and two-dimensional barcodes
IllustrationOne dimension or two Conceptual illustration contrasting the narrow information path of a linear barcode with the grid-like structure of a two-dimensional symbol.

Why the price is usually not inside the barcode

A supermarket barcode generally identifies an item; it does not normally contain its current price. When the scanner decodes the number, the checkout system uses that number to retrieve information from a retailer’s database. The database can associate the identifier with a product description, price, tax treatment, promotions and stock information.

This separation makes the system flexible. A retailer can change a price or run a discount without redesigning and reprinting every package. The barcode can remain the same while the database record changes. The number therefore acts more like a key that opens a record than like a complete label containing every fact about the product.

The distinction is important because not all barcodes carry the same kind of information. Some GS1 symbols are designed to include extra data, such as a serial number, batch or lot number, expiry date or measured weight. The information available at the checkout depends on both the barcode type and the systems connected to it.

What the digits are doing

A retail identifier is assembled according to rules intended to make it unique within the global system. GS1 explains that a GTIN can combine a company prefix with an item reference, followed by a check digit. The company prefix helps allocate numbers to an organisation, the item reference distinguishes products, and the final digit is calculated from the preceding digits.

The check digit is a small but useful safeguard. It allows a system to test whether the number has the expected structure and whether a simple scanning or typing error may have occurred. It does not prove that every detail about the product is correct; it checks the number’s mathematical consistency.

The individual digits should not be assumed to reveal a full story about a product. In particular, a retail GTIN is an identifier allocated within the GS1 system, not a miniature description of the ingredients, quality or price. Its practical purpose is to let different organisations refer to the same trade item consistently.

Why some barcodes are square

Linear barcodes are limited by the amount of information that can fit across a single line. NIST describes them as able to hold relatively little data compared with two-dimensional symbols. A two-dimensional barcode uses both height and width, allowing more cells and therefore more data within a compact area.

A QR code is one example of a two-dimensional barcode. Depending on the standard and the application, a 2D symbol may encode a web address, text, an identifier or structured business data. Image-based scanners can capture the whole symbol at once and use its layout to determine how the cells should be interpreted.

Two-dimensional symbols can also support error detection or correction, allowing some damaged or obscured patterns to remain readable. The exact capability depends on the symbology and how it has been encoded. A square pattern is therefore not simply a larger version of a supermarket barcode: it follows a different set of rules and can serve different purposes.

What to remember

  1. A barcode is a visual encoding of data, not a picture of the product.
  2. Most supermarket barcodes identify a product with a GTIN; the checkout usually looks up the price in a database.
  3. Scanners read differences in reflected light or analyse a captured image to decode the pattern.
  4. Quiet zones, strong contrast, correct dimensions and accurate printing help a barcode scan reliably.
  5. Linear barcodes hold limited data, while two-dimensional symbols can store more information and may include error correction.
  6. The digits beneath a barcode provide a human-readable backup, while the bars provide the machine-readable version.

Sources & further reading

Where this story comes from

  1. How do GS1 GTINs and barcodes work?GS1
  2. GS1 Barcodes – StandardsGS1
  3. 10 steps to barcode your productGS1
  4. How to create a GTINGS1
  5. Automated Identification Technologies for Forensic ScienceNational Institute of Standards and Technology
  6. The History of the Bar CodeSmithsonian Magazine

This story was researched, drafted and illustrated with AI, then automatically checked against ANTB's structural and sourcing rules. Use the linked primary and institutional sources to verify important details.