Everyday Life

How Do Barcodes Work?

By BodaWiki EditorialPublished 4 min read

In short

A barcode stores a product number as a pattern of dark bars and light spaces.[1][2] In a UPC-A barcode, each of the 12 digits is seven modules wide, made of two bars and two spaces.[1][2] A scanner reads the contrast between dark ink and light paper, and a final check digit confirms the number was read correctly.[1][2]

Close-up of an EAN-13 barcode printed on the corner of a cardboard tea box, with black bars of different widths above the 13-digit number 4 012346 278001.
Photo: SchmiAlf, 2024. CC0, via Wikimedia Commons.

Key facts

Digits in a UPC-A barcode
12[1]
Width of each digit
7 modules: 2 bars and 2 spaces[2]
GS1 Company Prefix length
6 to 10 digits[1]
UPC design chosen
March 30, 1973 (George Laurer's rectangular code)[4]
First UPC scan
June 26, 1974, Marsh Supermarket, Troy, Ohio[4]
First item scanned
10-pack of Wrigley's Juicy Fruit gum, 67 cents[1][5]
QR Code released
1994, by DENSO WAVE[7]
Barcode scans per day
More than 10 billion (GS1 US, 2024); about 6 billion (IBM)[8][5]

How do bars and spaces stand for digits?

A UPC barcode is a pattern of black lines that encodes a product number called a GTIN (Global Trade Item Number).[1] The standard UPC-A version, used mostly by retailers in North America, holds 12 digits, and barcodes in the same EAN/UPC family hold 8, 12 or 13.[1][2]

Barcode widths are measured in modules, the narrowest unit of width in a barcode.[2] In the GS1 specification, each digit takes up exactly seven modules, made of two dark bars and two light spaces, each one to four modules wide.[2] A UPC-A barcode reads from left to right as a guard pattern, six digits, a centre guard pattern, six more digits and a closing guard pattern.[2] The outer guard patterns act as start and stop patterns, and the three guard patterns together take up 11 modules.[2] By BodaWiki's arithmetic, the 12 digits add 84 modules, for 95 in total, matching the "95 bits of data" that IBM's history gives for George Laurer's design of 30 black and 29 blank lines.[2][5]

The two halves use different patterns. The number of dark modules in a digit gives it a "parity": the six digits on the left of a UPC-A have odd parity, and the six on the right have even parity.[2]

What do the numbers under a barcode mean?

GS1 US splits its sample UPC-A number, 6 14141 99999 6, into three parts.[1]

PartIn the exampleWhat it does
GS1 Company Prefix614141Identifies the brand owner; 6 to 10 digits, assigned by GS1[1]
Item reference99999Chosen by the brand owner; each size or flavor gets its own[1]
Check digit6Calculated from the first 11 digits[1]

A company needs a GS1 Company Prefix before it can use GS1 barcodes, and each prefix is globally unique.[3] Because companies can make products anywhere, the GS1 Prefix at the start of the number does not show where a product comes from.[3] A UPC-A barcode can also be decoded as a 13-digit number by adding an implied zero at the front; in the 13-digit EAN-13 format, a leading zero is reserved for these 12-digit numbers.[2][3]

How does the check digit catch mistakes?

To work out the check digit, the digits before it are multiplied alternately by 3 and 1, the results are added up, and the sum is subtracted from the nearest equal or higher multiple of ten.[2]

Applied to the GS1 US example (BodaWiki's own calculation, weighting the first digit by 3), the first 11 digits give a weighted sum of 144; the next multiple of ten is 150, and 150 minus 144 is 6, the printed check digit.[1][2] When a barcode is scanned, the system repeats this calculation instantly to confirm that the number is properly composed and was read correctly.[1] The industry committee that chose the UPC had required fewer than one undetected error in 20,000.[4]

How does a scanner read a barcode?

Scanning depends on contrast in reflected light: on a barcode printed in black ink on white paper, the paper typically reflects more than 75 percent of the light, while the ink reflects only about 3 to 8 percent.[2] Early UPC checkouts used a laser scanner to pick up the black and blank lines with a concentrated beam of light, and a microcomputer to decode them.[4] For EAN/UPC barcodes, decoding relies mainly on distances measured from the leading edge of one bar to the leading edge of the next.[2]

The number identifies the product, and the store's system uses it to look up the price.[1] With such point-of-sale systems, the price appears on the cash register automatically when an optical sensor scans the barcode.[7]

When was the first barcode scanned?

Joe Woodland got the idea on Miami Beach in January 1949, when Morse code's dots and dashes led him to draw lines in the sand.[4] He and Bernard Silver of the Drexel Institute of Technology filed a patent in 1949 that was granted in 1952.[4][6] Their patented design was a "bull's-eye" of circles.[4] IBM's history says that when grocers sought a scannable symbol around 1970, RCA owned the bull's-eye patent, and IBM engineer George Laurer judged that design too prone to smearing when printed and proposed a linear one.[5] A grocery industry committee chose Laurer's rectangular code on March 30, 1973.[4]

The first scan came just after 8 a.m. on June 26, 1974, at the Marsh Supermarket in Troy, Ohio.[4] Cashier Sharon Buchanan scanned a 10-pack of Wrigley's Juicy Fruit gum for Clyde Dawson, Marsh's head of research and development, and it cost 67 cents.[1][4][5] Dawson later explained that he picked the gum because nobody had been sure a barcode could be printed on something that small.[4]

Estimates of how often barcodes are scanned today differ: GS1 US said in 2024 that it happens more than 10 billion times a day, while IBM's history puts it at about 6 billion.[8][5]

How are QR codes different?

An ordinary barcode stores information in one direction only and holds about 20 letters or numbers.[7] A two-dimensional code stores it both across and up and down.[7] DENSO WAVE, then a division of DENSO Corporation, released the QR Code in 1994; "QR" stands for "quick response", and square position-detection marks made high-speed reading possible.[7] The company kept its patent rights but said it would not exercise them.[7]

A QR Code is a square grid of dark and light modules, from 21 by 21 up to 177 by 177 modules, and the largest, at the lowest error-correction level, can hold 7,089 digits.[2] Depending on the level chosen, its error correction can recover between 7 and 30 percent of the code's data.[2] Laser scanners cannot read QR codes; camera-based and other 2D imaging scanners can.[2] In 2024, GS1 US said brands were starting to put QR codes on packaging, and that retailers aim to accept them at checkout by 2027.[8]

Frequently asked questions

How does a store get the price from a barcode?

A UPC barcode encodes a product number called the GTIN, and the store's system uses that number to identify the item and look up its price.[1] In point-of-sale systems, the price then appears on the cash register automatically when the barcode is scanned.[7]

Do the first digits of a barcode show the country of origin?

No. GS1 says that because companies can make products anywhere in the world, GS1 Prefixes do not identify a product's country of origin.[3] The first 6 to 10 digits of a UPC-A number form the GS1 Company Prefix, which identifies the brand owner.[1]

Who invented the barcode?

Joe Woodland and Bernard Silver of the Drexel Institute of Technology applied for a barcode patent in 1949, and it was granted in 1952.[4][6] The rectangular UPC used in shops was designed by IBM engineer George Laurer and chosen by a grocery industry committee in 1973.[4][5]

What was the first product scanned with a barcode?

A 10-pack of Wrigley's Juicy Fruit chewing gum, scanned at the Marsh Supermarket in Troy, Ohio, on June 26, 1974.[1][4] It cost 67 cents.[5]

Why can't a laser scanner read a QR code?

QR codes store information in two directions, across and up and down, while ordinary barcodes store it in one.[7] GS1's specification says laser scanners and linear imagers cannot scan 2D barcodes; 2D imaging scanners and camera-based systems can.[2]

Sources

  1. [1]What is a UPC Code? · GS1 US · accessed October 5, 2026
  2. [2]GS1 General Specifications (Release 26.0) · GS1 · accessed October 5, 2026
  3. [3]GS1 Company Prefix · GS1 · accessed October 5, 2026
  4. [4]The History of the Bar Code · Smithsonian Magazine · accessed October 5, 2026
  5. [5]The UPC · IBM · accessed October 5, 2026
  6. [6]Milestones: Birthplace of the Bar Code, 1948 · IEEE History Center (Engineering and Technology History Wiki) · accessed October 5, 2026
  7. [7]History of QR Code · DENSO WAVE · accessed October 5, 2026
  8. [8]GS1 US Celebrates 50-Year Barcode 'Scanniversary' and Heralds Next-Generation Barcode To Support Modern Commerce · GS1 US · accessed October 5, 2026
Cite this article
APA
BodaWiki Editorial. (2026, October 4). How Do Barcodes Work? BodaWiki. https://bodawiki.com/wiki/how-do-barcodes-work
MLA
“How Do Barcodes Work?” BodaWiki, 4 Oct. 2026, bodawiki.com/wiki/how-do-barcodes-work.
Chicago
BodaWiki Editorial. “How Do Barcodes Work?” BodaWiki. October 4, 2026. https://bodawiki.com/wiki/how-do-barcodes-work.
  • barcodes
  • upc
  • qr codes
  • gs1
  • check digit
  • retail