Try the interactive model ↓

On 26 June 1974, a pack of Wrigley’s Juicy Fruit gum passed across a scanner at a Marsh supermarket in Troy, Ohio. That first commercial UPC, or Universal Product Code, scan made more than a purchase possible. A printed mark could connect a product to a computer record without someone typing its identity. GS1 US recounts the event in its UPC guide.

The familiar beep makes the operation seem indivisible. In reality, several questions must be answered in sequence. Can the machine distinguish ink from background? Can it decode the pattern? Does the resulting number satisfy its rules? And does the shop have the right record for that number? Success at one stage does not guarantee success at the next.

A practical invention needed an agreement

Norman Joseph Woodland and Bernard Silver developed an early barcode approach decades before the supermarket breakthrough. Their patent was granted in 1952; the proposed circular, bull’s-eye pattern offered a way to approach the symbol from different directions. A clever mark alone, however, did not produce an affordable checkout system.

By 1970, grocery retailers and manufacturers were seeking a common machine-readable symbol. At IBM, electrical engineer George Laurer led a team that developed the familiar straight-bar alternative. Printing reliability mattered: ink spread could distort the earlier circular design. Better scanning technology and computing helped turn the idea into practical equipment. IBM’s history describes the engineering and the industry’s adoption in 1973.

The less visible invention was cooperation. A shop had little reason to buy scanners if few packages carried readable codes; a manufacturer had little reason to print codes that shops could not use. Shared rules gave each side confidence that the other’s investment would work with its own. The stripes became useful because organisations agreed what they meant.

The white gaps carry information too

A laser scanner illuminates a path across the symbol and senses reflected light. Dark bars and pale spaces return different amounts of light. An image-based reader instead captures a picture and analyses the pattern. Either route must turn measured light into data. GS1 US explains both reader types and the importance of contrast.

The scanner is not recognising the printed digits as a person might. It reads the arrangement of bars and spaces. Their boundaries and widths matter together: counting black lines would discard much of the information. The numbers printed underneath provide a human-readable route when automatic reading fails.

Stripes become an identifier; a shop record supplies the price

1. Illuminate and sense reflected light

A laser reader sweeps across bars and spaces. Amber: light sent to the symbol. Teal: some light returns to a detector

Next: measure how that return changes along the scan

2. Recover boundaries and widths

Pale spaces give a higher light return; dark bars give a lower one. The steps below match the sample’s bar-and-space widths above

Next: decode the ordered pattern, rather than count black lines. The navy arrow follows scan position

3. Decode an identifier and check it

A decoder applies UPC-A’s pattern rules to obtain a twelve-digit GTIN-12. The twelve boxes represent digit positions; amber marks the final check digit

Next: a number that passes the arithmetic check can be used for lookup. It can still be copied or attached to the wrong product

4. Look up the shop’s current price

The checkout sends the identifier as a query. A matching shop record returns product information, including the current price

Result: the price can change while the product’s identifier and printed stripes stay the same

Only panel 1’s coloured arrows are light paths. In panel 3, navy arrows mean decoding into digit positions. In panel 4, the upper arrow is the identifier query and the lower arrow is the returned shop record. The amber row marks that record, not a price hidden in the symbol. An image-based reader instead starts with a captured picture

For an ordinary packaged product using UPC-A, a reader measures the bar-and-space pattern, decodes a twelve-digit GTIN-12 and checks its final digit. Checkout uses the identifier to retrieve the shop’s product record and current price. That price is not stored in these stripes.

Schematic teaching sample, not to scale and not an assigned or scannable barcode. The partial stripe pattern does not encode the twelve empty digit boxes. Signal levels are qualitative, not measurements. Other barcode applications, including variable-measure items and coupons, can carry price-related data. Passing a check digit proves neither authenticity nor a correct database record.

Sources: GS1 US: optical readers and contrast; GS1 US: UPC-A and other formats; GS1 US: the final check digit; GS1: identifier lookup, price and exceptions; GS1: structural validity and authenticity differ

That explains why a mark can look acceptable to us yet cause trouble for a machine. A wrinkle changes geometry; poor printing blurs boundaries; nearby artwork can intrude on the clear margins. Those margins are called quiet zones. They help separate the symbol from its surroundings. GS1’s printing and placement guidance stresses clean lines, suitable contrast and clear space beside the code.

A number is not a price tag

For an ordinary packaged product, a UPC-A symbol carries a twelve-digit identifier. The checkout uses that identifier to look up information, including the shop’s price. The same package can therefore sell at different prices in different shops without acquiring different stripes merely for that reason.

The identifier and the printed symbol are related but distinct. The Global Trade Item Number, or GTIN, identifies the trade item; the barcode is a machine-readable way to carry it. Product variations such as different sizes require appropriate distinct identifiers. A product identifier also need not distinguish every individual physical packet of the same product.

Not every barcode has the same capacity or purpose. EAN-13 uses thirteen digits, while other formats can carry attributes such as batch numbers or dates. GS1’s guide to barcode types explains these differences. Reading one ordinary UPC does not magically reveal everything about an object’s origin, contents or journey.

One digit checks the others

In a twelve-digit UPC identifier, the last digit is calculated from the preceding eleven. It adds a built-in check, called redundancy: the full number must obey an arithmetic rule. GS1’s check-digit calculator provides an independent way to check the result.

Here is a made-up example, used only for arithmetic: 12345678901. Count positions from the left. Add the digits in odd positions and multiply their sum by three. Add the digits in even positions once. The result is 98, so the final digit is 2, making the total 100. The complete illustrative number is 123456789012. GS1’s manual calculation instructions link to a worked explanation of this procedure.

Change the first digit from 1 to 2 while leaving the original check digit attached. The weighted total becomes 103. It is no longer divisible by ten, so the check fails. Every substitution of one decimal digit by a different digit is detected by this rule, assuming the number retains its length and all other digits stay unchanged.

Why some swaps escape
This follows directly from the arithmetic. Positions with different weights use three and one. Swapping digits a and b changes the weighted total by twice their difference, with sign depending on position. If the digits differ by five, the change is ten: divisibility by ten survives. In our example, swapping the 1 and 6 in positions one and six gives 623451789012. Its total is 110, so the wrong number still passes. This is a calculated example, not a measured scanner error rate.

The interactive model lets you test both outcomes. Crucially, it keeps the original check digit fixed. Recalculating a new check digit after every edit would simply create another internally consistent number and hide the mistake we want to investigate.

What a successful beep cannot prove

A check digit detects certain errors; it does not establish ownership, authenticity or a correct database entry. A copied identifier can pass. A valid number attached to the wrong product can pass. Nor does this one-digit check normally tell the system which digit to repair. Detecting an inconsistency and reconstructing lost information are different engineering tasks.

A barcode therefore gives useful information, but it cannot tell us everything about a product. It makes a repeatable connection between marks, numbers and records, with checks along the way. The ordinary beep compresses that whole chain into a sound. Understanding the chain reveals why it works so often and why one reassuring sound can never substitute for correct information behind it.

EXPLORE THE IDEA

Which mistakes does one digit catch?

Start with an illustrative twelve-digit number. Change a data digit while keeping its original final check digit, 2. Positions count from the left.

Decoded digits · amber marks changes from the original1×332×123×394×145×3156×167×3218×189×3270×101×332×12Bottom row: each digit’s contribution. Final column: check digit.

Scroll the diagram sideways to see all twelve digits.

100Weighted total

0Remainder ÷ 10

Passes arithmetic checkOriginal example

Exact GTIN-12 arithmetic on illustrative numbers; no units. This is not an optical scanner, assigned product code or authenticity check. Multiple edits can cancel each other. No animation. Reset before testing a single substitution.

YOUR PERSPECTIVE

Join the discussion

What surprised you? Have a question or a correction? Share your thinking.

No comments yet. Start the conversation.

Sign in with ChatGPT to comment