CodeBox Hub
FREE

What Is a Barcode?

A barcode stores data as parallel bars and spaces. Learn EAN-13, UPC-A and ITF-14 structure, GS1 print rules, check digits and how scanners read them.

# What Is a Barcode?

A barcode is a printed pattern of parallel bars and spaces whose widths encode data, so an optical reader can capture it in milliseconds without a keyboard. Every one-dimensional barcode carries a number: UPC-A carries 12 digits, EAN-13 carries 13, ITF-14 carries 14. GS1, the standards body behind retail numbering, puts the volume at over 1 billion products identified by GS1 barcodes and roughly 10 billion scans every day. The full family of formats is compared on the barcode symbologies page; this article covers what the symbol is made of, why the number under it is not arbitrary, and which print rules decide whether it scans.

Anatomy of a barcode

A linear symbol is not a random stripe pattern. Each element has a defined job, and a reader fails when any one of them is compromised.

ElementWhat it isWhy a reader needs it
Quiet zoneBlank margin at each end of the barsMarks where the symbol starts and ends, so artwork never reads as data
Guard barsExtended bars at the left, centre and rightFix the digit boundaries and let the code be scanned in either direction
Data barsThe bars and spaces between the guardsCarry the encoded digits as width ratios
X-dimensionWidth of the narrowest elementSets the whole symbol size; every other width is a multiple of it
Human-readable numberDigits printed under the symbolLets a cashier key the code in when the symbol will not scan
Check digitThe final digit, computed from the othersDetects most keying and misreads before the price lookup happens

Because the data lives in width ratios rather than absolute sizes, the same symbol can be printed at many different scales. The limit is the X-dimension: shrink the narrow bar too far and the reader can no longer separate a 2-wide element from a 3-wide one. That is why GS1 General Specifications fixes a minimum, a target and a maximum X-dimension for each symbology rather than a single size.

How a scanner reads it

A scanner lights the symbol and measures reflected intensity. Bars absorb light, spaces return it, so the reflected signal is a sequence of transitions whose timing encodes element widths. The decoder finds the quiet zone, locks onto the guard bars, groups elements into characters and validates the check digit before returning a number.

Two practical consequences follow. First, a barcode is read by reflectance, not by shape, so contrast matters more than resolution: a symbol printed in a pale colour, or printed with too little ink spread, can carry the right geometry and still fail. Second, barcode readers are symbology-specific: a reader must know the format to group widths correctly, which is why the symbology choice on a label is not cosmetic. Retail POS readers are built around the EAN/UPC family, and the symbology itself is standardised as ISO/IEC 15420.

The symbology family

Nine formats cover almost everything printed on products, cases and logistics labels. Each has its own character set, length rule and standard.

SymbologyData carriedStandardWhere it is used
EAN-1313 digitsISO/IEC 15420Retail point of sale outside North America, GTIN-13
UPC-A12 digitsISO/IEC 15420Retail point of sale in the US and Canada, GTIN-12
EAN-88 digitsISO/IEC 15420Small packages where a 13-digit symbol will not fit
ITF-1414 digitsISO/IEC 16390Corrugated shipping cases, GTIN-14 with bearer bars
Code 128All 128 ASCII values, variable lengthISO/IEC 15417Warehouse, shipping and internal asset labels
GS1-128Code 128 plus Application IdentifiersGS1 General SpecificationsBatch, expiry, serial numbers on logistics labels
Code 3943 charactersISO/IEC 16388Automotive and legacy military asset tracking
Data MatrixText and binary in a square gridISO/IEC 16022Small items, electronics, healthcare marking
QR codeText and binary in a square gridISO/IEC 18004Consumer links, payments, menus

EAN-13, UPC-A, EAN-8 and ITF-14 all belong to the same EAN/UPC family, so a POS reader that handles one handles the others. Code 128 and GS1-128 trade a fixed digit count for variable-length text, which is why logistics labels moved to them; the Code 128 guide covers the three code sets and the mod-103 check. Case-level numbering is covered on the ITF-14 guide.

These values come straight from the GS1 symbol specification tables. Height is measured across the bars only, excluding the human-readable digits, and quiet zones are expressed as multiples of the X-dimension.

SymbologyX-dimension min / target / max (mm)Minimum symbol height (mm)Quiet zone left / right
EAN-80.264 / 0.330 / 0.66014.58 / 18.23 / 36.467X / 7X
EAN-130.264 / 0.330 / 0.66018.28 / 22.85 / 45.7011X / 7X
UPC-A0.264 / 0.330 / 0.66018.28 / 22.85 / 45.709X / 9X
ITF-140.495 / 0.495 / 1.01631.7510X / 10X

EAN/UPC symbols keep a fixed height-to-width relationship, so scaling one dimension without the other breaks the symbol: GS1 US guidance states plainly that truncating the height is not recommended because it stops the symbol scanning at the point of sale. If a layout is tight, regenerate at the correct ratio in the barcode generator instead of stretching a downloaded image, then place the result on the label sheet with the quiet zone preserved.

Why the number is not arbitrary

The digits under an EAN-13 form a GTIN-13, and the last digit is derived from the other 12. Take the odd positions times 1 and the even positions times 3, add them, and the check digit is (10 minus that sum modulo 10) modulo 10. For the data digits 400638133396 the weighted sum is 98, so the check digit is 2 and the finished code is 4006381333962.

We tested what that actually protects against rather than repeating the usual claim, enumerating every single-digit error and every transposition:

Error typeDetectedUndetected
One digit keyed wrong117 of 117 cases0
Two neighbouring digits swapped880 of 990 cases110
Two digits swapped with one digit between them0 of 2,700 cases2,700

The full enumeration, including the cross-format rule that works for every GTIN length, is on the EAN-13 check digit page, along with the EAN-13 versus UPC comparison of the two retail key lengths.

Do barcode prefixes show where a product was made?

No, and this is the single most repeated misunderstanding about barcodes. The leading digits identify the GS1 member organisation that issued a company prefix, not the factory. GS1's own reference page states that because member companies can manufacture anywhere in the world, GS1 prefixes do not identify the country of origin for a given product. GS1 US said the same publicly in 2020 after viral posts claimed the first three digits reveal manufacturing location. Codes beginning 690 to 699 were allocated to GS1 China, 400 to 440 to GS1 Germany, 500 to 509 to GS1 UK: that tells you where the company licensed its prefix, which often but not always matches its headquarters. The full allocation table is on the GS1 company prefix page.

Barcode or QR code

Use a one-dimensional barcode when the payload is a registered product number that a POS system must recognise, and a two-dimensional code when the payload is a link, a text string or a few hundred bytes of data. A linear symbol needs a symbology-specific reader and stores at most a couple of dozen characters; a QR code stores up to 2,953 bytes and any phone camera can read it. Retail is converging on two-dimensional codes at the checkout, but the EAN/UPC number underneath stays the item's identity either way. For the dimension-by-dimension comparison see QR code vs barcode and for the other 2D family member QR code vs Data Matrix.

A short history

  • 1948: the US chain Food Fair asked Drexel Institute of Technology to research automatic product identification at the checkout.
  • 20 October 1949: Bernard Silver and Norman Joseph Woodland filed the patent later described as "Classifying Apparatus and Method", covering both a linear pattern and a concentric bullseye. It was granted on 7 October 1952 as US patent 2,612,994.
  • 1970: a McKinsey-led grocery Ad Hoc Committee asked for a machine-readable product code. IBM engineer George Laurer rejected the bullseye because a circular pattern smears on a high-speed press, and designed the linear symbol; see IBM's account.
  • 1 April 1973: the Universal Product Code was adopted, and the Uniform Code Council became its administrator.
  • 26 June 1974: the first retail scan, a 10-pack of Wrigley's Juicy Fruit costing 67 cents, at a Marsh supermarket in Troy, Ohio, on an NCR checkout with a Spectra Physics laser scanner. The scanner is held in the Smithsonian's collection.
  • 1977: the European Article Numbering Association was founded in Brussels, making EAN compatible with UPC.
  • February 2005: EAN and UCC merged into GS1, which today coordinates 116 member organisations.

FAQ

What is a barcode in simple terms?

A printed pattern of bars and spaces whose widths stand for digits, so a light-based reader can enter a product number into a computer without anyone typing it.

What are the three parts of a barcode?

Quiet zones at each end, guard bars that mark the boundaries, and the data bars in between, followed by a check digit and a human-readable copy of the number.

How many digits does a barcode have?

UPC-A has 12 digits, EAN-13 has 13, EAN-8 has 8 and ITF-14 has 14. Code 128 is not digit-based: it encodes up to a few dozen characters of text.

Is a UPC the same thing as an EAN?

Both belong to the EAN/UPC symbology family defined by ISO/IEC 15420. UPC-A is the 12-digit form used in the US and Canada, EAN-13 the 13-digit form used elsewhere, and either scans at modern retail checkouts.

Do barcode prefixes tell you the country of origin?

No. The prefix identifies the GS1 member organisation that issued the company prefix. A company licensed in one country can manufacture in another, and GS1 states explicitly that prefixes do not indicate country of origin.

Why will my barcode not scan?

Almost always the print, not the data: the X-dimension below the symbology minimum, height truncated relative to width, quiet zone covered by artwork, or contrast too low for the reader to measure reflectance. Regenerate at the correct ratio rather than resizing an image.

Can a phone camera read a barcode?

Yes, with an app or a web page that decodes the symbology, because the phone needs software to group the bar widths, and cameras are not tuned for the reflectance margins a fixed POS reader assumes. Phone cameras read QR codes natively because decoding is built into the operating system.

Are barcodes being replaced by QR codes?

At retail checkouts both are being accepted, and GS1 has agreed that QR Code, GS1 DataMatrix and Data Matrix are the 2D carriers for point of sale. The item number underneath stays the same, so a linear barcode still identifies the product even where a 2D code is added above it.

Keep reading

Contact us