UPC, EAN or Code 128: which barcode do you need?
The main barcode types explained — 12-digit UPC-A, 13-digit EAN-13, EAN-8, ITF-14, Code 128 and Code 39 — and which one fits your products or labels.
Updated
Tools for this job: Barcode Generator · QR Code Generator
Barcodes look alike, but each format has its own rules about what it can hold and where it is accepted. Choosing the right one comes down to a single question: will it be scanned at a shop till, or only inside your own business?
Retail barcodes
- UPC-A — 12 digits. The standard retail barcode in North America, also called UCC-12.
- EAN-13 — 13 digits. The retail standard across most of the rest of the world. In Japan it is called JAN.
- EAN-8 — 8 digits. A shorter version for products too small for an EAN-13.
- ITF-14 — 14 digits. Used on outer cartons and cases rather than on the product itself.
All of these end in a check digit, calculated from the others so a scanner can detect a misread. The Barcode Generator adds it for you: type 12 digits for an EAN-13 and it supplies the 13th, or type all 13 and it verifies them.
What the digits mean
A retail barcode number is not random. It is a Global Trade Item Number, or GTIN, made of three parts: a company prefix that GS1 assigns to the brand owner, an item number the company chooses for each product, and the check digit.
The first digits show which national GS1 organisation issued the prefix — numbers beginning 50 come from the UK, 400 to 440 from Germany, 890 from India, and most numbers beginning 0 or 1 from the United States and Canada. That is where the company registered, not where the product was made: goods manufactured in one country routinely carry a prefix from another. Two ranges have special uses. Numbers beginning 978 or 979 are books, where the barcode is the ISBN. And EAN-13 numbers beginning with 2 are reserved for a shop's own use, such as the labels printed for cheese or meat weighed at the counter.
How the check digit is calculated
The check digit is simple enough to work out by hand, which is useful when a number will not scan and you want to know whether it was mistyped. For an EAN-13, take the first 12 digits, add up the digits in the odd positions, add three times the digits in the even positions, and find what you must add to reach the next multiple of ten.
Take 400638133393:
- Odd positions: 4 + 0 + 3 + 1 + 3 + 9 = 20.
- Even positions: 0 + 6 + 8 + 3 + 3 + 3 = 23, and 23 × 3 = 69.
- Total: 20 + 69 = 89. The next multiple of ten is 90, so the check digit is 1.
The full number is 4006381333931. UPC-A works the same way with the weights swapped: the odd positions are multiplied by three. If a scanner reads a digit wrongly, the sum no longer ends in zero and the scan is rejected instead of ringing up the wrong product.
You need a registered number to sell in shops
Any barcode will scan, but a retailer's system identifies products by the number, and numbers for retail are allocated by GS1, the organisation that runs the system. A number you invent will scan as a number that means nothing — or, worse, as someone else's product. If you are selling through shops or large marketplaces, get your numbers from GS1 in your country first, then generate the barcodes.
Be careful with very cheap barcodes sold by resellers. They are usually numbers from prefixes issued to another company years ago. They scan, but the prefix is registered to that other company, and retailers and marketplaces that check numbers against GS1's database may refuse the listing. If a retailer has told you which source they accept, follow that.
Barcodes for your own use
- Code 128 encodes any printable text — letters, numbers and symbols — compactly. It is the workhorse for shipping labels, stock control, asset tags and anything internal.
- Code 39 is an older format with a smaller character set, still common in automotive and defence logistics.
- Codabar turns up in libraries and laboratories.
For internal use you can encode any value you like — no registration needed.
Between the first two, choose Code 128 unless something forces Code 39 on you. Code 39 holds only capital letters, digits and seven symbols (space, hyphen, full stop, dollar, slash, plus and percent), and it produces a wider barcode for the same content. Code 128 handles lower-case letters and packs digits tightly, so a long serial number fits on a small label. Code 39 survives mainly where an industry standard or an old scanner requires it.
A quick way to choose
- A product sold in shops in North America: UPC-A, with a GS1 number.
- A product sold in shops elsewhere: EAN-13, with a GS1 number. Tills in North America read EAN-13 as well.
- A very small product: EAN-8, which needs its own short number from GS1.
- A carton or case of products: ITF-14.
- Stock, assets, shelves, internal shipping labels: Code 128.
- A link, contact details or Wi-Fi for a phone to read: not a barcode at all — use a QR code.
Converting UPC to EAN
Put a 0 in front. A 12-digit UPC-A with a leading zero is a valid 13-digit EAN-13, and the check digit stays the same, because the extra zero adds nothing to the calculation.
For example, the UPC-A number 036000291452 becomes the EAN-13 number 0036000291452. Both end in 2, and both describe the same product. This is why one number from GS1 works in both systems.
Code 128 is not GS1-128
GS1-128 — once called EAN-128 or UCC-128 — is Code 128 with a special start character (FNC1) and standard “application identifiers” for things like batch numbers and expiry dates. It is used on logistics labels that trading partners must be able to read automatically. The Barcode Generator produces standard Code 128, which suits internal and shipping labels, but it does not add FNC1, so it cannot make certified GS1-128 labels.
Printing tips
Download SVG for print so the bars stay sharp at any size, keep a clear margin either side, print dark bars on a light background, and test with a real scanner or phone app before printing a full run. For links, contact details or Wi-Fi, a QR code is the better fit — phones read them with the camera app.
- Size. The standard size of an EAN-13 symbol, including its margins, is 37.29 mm wide by 25.93 mm high. The GS1 rules allow it to be printed between 80% and 200% of that. Going smaller risks scan failures at the till.
- Do not squash it. Reducing the height of the bars to save space makes the code harder to scan at an angle. Scale the whole symbol instead.
- Colour. Black on white is safest. Scanners use red light, so red bars look the same as the background and cannot be read, and a red or dark background swallows the bars.
- Surface. Avoid seams, folds, curves and shrink wrap across the bars. On a bottle, turn the barcode so the bars run around the curve like the rungs of a ladder.