How to Read a Barcode

To read a barcode, scan it with a scanner or phone, or read the digits underneath: on a retail UPC or EAN they are a GS1 prefix, a company number, an item number and a final check digit. The bars encode exactly the same digits in a pattern of black and white widths.

Short answer: you don’t need to decode bars by hand. Point a phone at the code with our online barcode scanner, or upload a photo to scan barcode from image. To understand a retail number, read the digits under the bars: GS1 prefix, then company prefix, then item reference, then the check digit. Then use the barcode lookup to find the product.

What do the numbers on a barcode mean?

Take this EAN-13 barcode as an example:

EAN-13 barcode for 9520123456788, used as a reading example
EAN-13: 9520123456788
DigitsPartMeaning
952GS1 prefixIdentifies the issuing GS1 organisation. 952 is reserved by GS1 for examples and demonstrations.
0123Rest of the company prefixTogether with the GS1 prefix, identifies the brand owner. Company prefixes vary in length.
45678Item referenceChosen by the brand owner for this specific product variant.
8Check digitCalculated from the first 12 digits to catch misreads.

Because company prefixes vary in length, you can’t tell where the company part ends just by looking. A large brand with a short prefix has more digits left for its products. Some prefixes are special: 978/979 mean a book (the ISBN), 977 a magazine (ISSN), and 20–29 are for in-store use, such as weighed produce. Check any prefix with barcode country codes.

A 12-digit UPC-A works the same way, but its first digit is a number-system digit: 0, 1, 6, 7 and 8 for normal products, 2 for random-weight items, 3 for drugs, 4 for in-store use and 5 for coupons.

How do the bars encode the digits?

A UPC or EAN barcode is 95 equal-width columns called modules. A bar or space can be 1, 2, 3 or 4 modules wide. Reading left to right:

  1. Left quiet zone: a blank margin so the scanner knows where the code starts.
  2. Start guard (bar-space-bar, 3 modules): the slightly longer bars at the left edge.
  3. Six left-hand digits, 7 modules each, every digit made of 2 bars and 2 spaces.
  4. Centre guard (5 modules): the long bars in the middle.
  5. Six right-hand digits, 7 modules each.
  6. End guard (3 modules) and the right quiet zone.

That adds up to 3 + 42 + 5 + 42 + 3 = 95 modules. Left-hand digits start with a space and right-hand digits start with a bar, and the patterns differ in parity, so a scanner can tell which way up it is reading and can scan the code upside down.

EAN-13 has one more digit than there are positions. The first digit isn’t drawn as bars at all: it is encoded in which of two patterns (odd or even parity) each of the six left-hand digits uses. For a UPC-A, all left-hand digits use odd parity, which is why a UPC-A reads as an EAN-13 starting with 0.

DigitLeft, odd (L)Left, even (G)Right (R)
0000110101001111110010
1001100101100111100110
2001001100110111101100
3011110101000011000010
4010001100111011011100
5011000101110011001110
6010111100001011010000
7011101100100011000100
8011011100010011001000
9000101100101111110100

1 = a dark module (bar), 0 = a light module (space).

How does the check digit work?

The check digit lets a scanner detect most single-digit errors and swapped neighbours. For an EAN-13 or UPC-A:

  1. Starting from the digit just left of the check digit and moving left, multiply the digits alternately by 3 and 1.
  2. Add up the results.
  3. The check digit is the number you add to reach the next multiple of 10.

For 952012345678: (8×3) + (7×1) + (6×3) + (5×1) + (4×3) + (3×1) + (2×3) + (1×1) + (0×3) + (2×1) + (5×3) + (9×1) = 102. The next multiple of 10 is 110, so the check digit is 8. The check digit calculator does this for UPC, EAN, GTIN-14, SSCC and ISBN.

How do I read other barcode types?

Other symbologies use different patterns, and most don’t follow the GS1 number structure:

  • Code 128 and Code 39 encode letters and numbers chosen by whoever made the label, such as a SKU or asset tag. The printed text is usually the data itself.
  • GS1-128 shows data in brackets: (01) is the GTIN, (17) an expiry date as YYMMDD, (10) a batch or lot, (21) a serial number and (00) an SSCC pallet code.
  • QR codes and Data Matrix have no printed digits. Scan them to see the content, with a phone camera or the QR code scanner.
GS1-128 barcode showing GTIN, expiry date 31 December 2027 and batch LOT42
GS1-128 with GTIN, expiry and batch

Tools for reading barcodes

You haveUse
The physical product and a phone or webcamOnline barcode scanner
A photo, screenshot or PDF pageScan barcode from image or barcode decoder
Just the numberBarcode lookup, UPC lookup or ISBN lookup
A number you want to checkBarcode validator

Frequently asked questions

How do you read a barcode?

The easiest way is to scan it: use a barcode scanner, a phone app or our free online barcode scanner. To read one by eye, look at the digits printed under the bars. On a retail barcode they split into a GS1 prefix, a company number, an item number and a check digit.

Does a barcode tell you the country of origin?

No. The first digits of an EAN-13 show which national GS1 organisation issued the company’s prefix, not where the product was made. A company registered with GS1 UK can manufacture anywhere and still use a 50x prefix.

Can I find out what product a barcode belongs to?

Often, yes. Type the number into the barcode lookup, which searches open product databases. The barcode itself contains only the number; the product name and price live in a retailer’s or brand’s database.

What does the last digit of a barcode mean?

It is a check digit, calculated from all the other digits. Scanners use it to catch misreads. You can verify it with the check digit calculator.

Do barcodes contain the price?

Normally no. A standard UPC or EAN holds only the product number, and the till looks up the price. The exception is variable-weight items (such as deli or meat counter labels with a prefix of 2 in UPC or 20–29 in EAN), where the store may encode the price or weight in the code.

How do I read a barcode from a photo?

Upload the image to scan barcode from image. It finds and decodes every barcode in the picture in your browser, without uploading the image.

Related free tools