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:
| Digits | Part | Meaning |
|---|---|---|
952 | GS1 prefix | Identifies the issuing GS1 organisation. 952 is reserved by GS1 for examples and demonstrations. |
0123 | Rest of the company prefix | Together with the GS1 prefix, identifies the brand owner. Company prefixes vary in length. |
45678 | Item reference | Chosen by the brand owner for this specific product variant. |
8 | Check digit | Calculated 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:
- Left quiet zone: a blank margin so the scanner knows where the code starts.
- Start guard (bar-space-bar, 3 modules): the slightly longer bars at the left edge.
- Six left-hand digits, 7 modules each, every digit made of 2 bars and 2 spaces.
- Centre guard (5 modules): the long bars in the middle.
- Six right-hand digits, 7 modules each.
- 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.
| Digit | Left, odd (L) | Left, even (G) | Right (R) |
|---|---|---|---|
| 0 | 0001101 | 0100111 | 1110010 |
| 1 | 0011001 | 0110011 | 1100110 |
| 2 | 0010011 | 0011011 | 1101100 |
| 3 | 0111101 | 0100001 | 1000010 |
| 4 | 0100011 | 0011101 | 1011100 |
| 5 | 0110001 | 0111001 | 1001110 |
| 6 | 0101111 | 0000101 | 1010000 |
| 7 | 0111011 | 0010001 | 1000100 |
| 8 | 0110111 | 0001001 | 1001000 |
| 9 | 0001011 | 0010111 | 1110100 |
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:
- Starting from the digit just left of the check digit and moving left, multiply the digits alternately by 3 and 1.
- Add up the results.
- 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.
Tools for reading barcodes
| You have | Use |
|---|---|
| The physical product and a phone or webcam | Online barcode scanner |
| A photo, screenshot or PDF page | Scan barcode from image or barcode decoder |
| Just the number | Barcode lookup, UPC lookup or ISBN lookup |
| A number you want to check | Barcode 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.