The main barcode types at a glance
| Type | Data | Check digit | Typical use |
|---|---|---|---|
| EAN-13 | 13 digits | Yes (mod 10) | Retail products worldwide; books (ISBN starting 978/979) |
| EAN-8 | 8 digits | Yes (mod 10) | Very small retail packages |
| UPC-A | 12 digits | Yes (mod 10) | Retail products in the US and Canada |
| Code 128 | Any ASCII text | Yes (mod 103, hidden) | Logistics, shipping labels, inventory, internal IDs |
| Code 39 | Digits, A–Z, a few symbols | Optional | Industry, badges, older systems |
| ITF-14 | 14 digits | Yes (mod 10) | Outer shipping cartons |
EAN-13 and UPC-A: retail product codes
These are the codes on almost everything you buy. Both carry a GTIN (Global Trade Item Number) issued through GS1, the organisation that manages retail numbering. An EAN-13 is made of:
- GS1 prefix (first 2–3 digits) — identifies the national GS1 organisation that issued the company number, for example 00–13 for the US and Canada, 460–469 for Russia, 476 for Azerbaijan. It does not say where the product was made.
- Company prefix and item reference — assigned by the brand owner within its GS1 allocation.
- Check digit — the last digit, calculated from the others to catch scanning or typing errors.
UPC-A is the 12-digit North American version. Put a 0 in front of a UPC-A number and you get the equivalent EAN-13, which is why modern checkout scanners handle both.
How to calculate the check digit (worked example)
Take the EAN-13 4006381333931. Check the first 12 digits:
| Digit | 4 | 0 | 0 | 6 | 3 | 8 | 1 | 3 | 3 | 3 | 9 | 3 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 4 | 0 | 0 | 18 | 3 | 24 | 1 | 9 | 3 | 9 | 9 | 9 |
- Sum of products: 4 + 0 + 0 + 18 + 3 + 24 + 1 + 9 + 3 + 9 + 9 + 9 = 89.
- Remainder after dividing by 10: 89 mod 10 = 9.
- Check digit = (10 − 9) mod 10 = 1. It matches the last digit, so the code is valid.
UPC-A uses the same idea with weights 3, 1, 3, 1… from the left. For 03600029145: digits in odd positions 0+6+0+2+1+5 = 14, × 3 = 42; even positions 3+0+0+9+4 = 16; total 58, so the check digit is 2 → 036000291452. The general rule for all GTINs (EAN-8, UPC-A, EAN-13, ITF-14): starting from the rightmost data digit, weight alternately 3 and 1.
Our barcode generator does this automatically: enter the number without the last digit and it is added, or enter the full number and it is validated.
Code 128: for everything that is not a retail product
Code 128 can encode any ASCII text — letters, digits and punctuation — and is very compact, especially for long runs of digits. It has a built-in check character (modulo 103) that scanners verify; it is not shown in the human-readable text. Use it for warehouse locations, internal SKUs, asset tags, document numbers and shipping labels. The GS1-128 variant adds standard “application identifiers” for batch numbers, expiry dates and weights in supply chains.
Code 39 and ITF-14
- Code 39 supports digits, uppercase letters and a few symbols (space, - . $ / + %). It is simple and widely supported but takes much more width than Code 128 for the same data. Mostly used where older equipment or industry standards require it.
- ITF-14 encodes a 14-digit GTIN for cartons and cases, often printed directly on corrugated cardboard, usually with a thick bearer bar around it.
Printing tips
- Use dark bars on a light background — black on white is ideal. Red bars may not be visible to scanners that use red light.
- Keep the blank margins (quiet zones) on both sides; text or edges too close make codes unreadable.
- Don’t squash the code horizontally. For EAN-13, the nominal size is about 37.3 × 25.9 mm; GS1 allows scaling within a limited range, so check its guidelines if you print smaller.
- Prefer SVG for print: it stays sharp at any size. Test-scan a printed sample before ordering a large run.
Need a 2D code instead — for a URL or Wi-Fi details? Use the QR code generator.
Frequently asked questions
What is the difference between EAN-13 and UPC-A?
UPC-A has 12 digits and comes from North America; EAN-13 has 13 digits and is used worldwide. A UPC-A number is the same as an EAN-13 with a leading zero, and retail scanners read both.
Which barcode should I use for products sold in stores?
EAN-13 (or UPC-A in the US and Canada) with a number issued under your own GS1 company prefix. Retailers and marketplaces check that the number really belongs to your company.
Can I make up my own EAN numbers?
For internal use such as stock labels, you can — but Code 128 with your own codes is a better fit. For products sold through retailers or marketplaces you need numbers from GS1; invented ones can clash with real products and get listings rejected.
How is the EAN-13 check digit calculated?
Multiply the first 12 digits alternately by 1 and 3 (starting with 1), add the results, and take the number that brings the sum up to the next multiple of 10. For 400638133393 the sum is 89, so the check digit is 1.
What barcode can store letters?
Code 128 encodes all 128 ASCII characters (letters, digits, punctuation) and is compact. Code 39 supports uppercase letters, digits and a few symbols but produces wider codes.