QR & Barcodes • 5 min read

EAN-13 Barcodes Explained: Structure, Check Digits and Getting Real Numbers

How the 13 digits of an EAN barcode are built, how to calculate the check digit by hand, why retail products need GS1 numbers, and how to print barcodes that scan.

Published: 2026-11-11 • Last Updated: 2026-11-11 • By Mohammed Zawwar Hussain

Interactive Online Tools Referenced in this Guide

What the 13 digits mean

An EAN-13 number, now officially called a GTIN-13, identifies one specific product, such as a 500 ml bottle of a particular brand of shampoo. It has three parts:

  • GS1 company prefix (typically 7 to 10 digits): starts with a country prefix of the GS1 organisation that issued it, for example 628 for GS1 Saudi Arabia, and identifies the brand owner.
  • Item reference: the remaining digits before the last, which the company assigns to each product, size and variant.
  • Check digit: the final digit, calculated from the other twelve so scanners can detect misreads.

The country prefix shows which GS1 office issued the number, not where the product was made.

Calculating the check digit by hand

Take the first 12 digits. Multiply them alternately by 1 and 3, starting with 1 on the left, and add the results. The check digit is the amount needed to reach the next multiple of 10.

Digits: 4 0 0 6 3 8 1 3 3 3 9 3
Weights: 1 3 1 3 1 3 1 3 1 3 1 3
Products: 4 0 0 18 3 24 1 9 3 9 9 9 → sum = 89
Next multiple of 10 = 90 → check digit = 90 − 89 = 1
Full EAN-13: 4006381333931

The Barcode Generator does this for you: type 12 digits and it adds the check digit, or type 13 and it tells you if the last digit is wrong, which catches most typing errors.

Why you cannot just invent a number

Supermarkets, pharmacies and online marketplaces use the barcode as the product's unique key in their systems. A made-up number may already belong to another company's product, so your item would show up at the till as something else, or be rejected by the retailer. Retailers and marketplaces generally require GTINs licensed from GS1. In Saudi Arabia that is GS1 Saudi Arabia, which issues company prefixes for an annual fee based on how many products you need to number.

Buying cheap "barcode numbers" from resellers is risky: the numbers may be registered to another company in the GS1 database, and major retailers check.

EAN-13, UPC and Code 128: which one to use

FormatHoldsUse it for
EAN-1313 digitsRetail products sold outside North America
UPC-A12 digitsRetail in the US and Canada (a UPC-A is an EAN-13 with a leading 0)
Code 128Letters, digits, symbolsInternal stock codes, shelf labels, asset tags, shipping
QR codeUp to thousands of charactersLinks, payment, menus; read by phone cameras

For your own warehouse or shop inventory, Code 128 with your own SKU codes, such as SKU-1042-BLK, is simpler and needs no registration.

Printing barcodes that scan

  • Size: the nominal EAN-13 symbol is 37.29 × 25.93 mm at 100% magnification. GS1 allows roughly 80% to 200% of that; smaller than 80% is unreliable.
  • Quiet zones: keep clear white space on both sides of the bars, especially on the left; text or a box edge too close is the most common printing error.
  • Colour: black or dark blue bars on white. Red bars are invisible to many scanners, which use red light.
  • Format: download SVG and place it at 100% scale. Do not stretch it horizontally to fit a label.
  • Test: scan the first printed sample with a real retail scanner, not only a phone app.

Converting a UPC-A number to EAN-13

A 12-digit UPC-A code from a North American supplier becomes a valid EAN-13 by adding a 0 in front. The check digit stays exactly the same, so 036000291452 becomes 0036000291452. Scanners outside North America read both, and many retail systems store every code as a 13- or 14-digit GTIN internally.

Selling on online marketplaces

Large online marketplaces normally ask for a GTIN (an EAN-13 or UPC) for each product so they can match listings for the same item. Some offer an exemption process for private-label, handmade or unbranded products, typically requiring proof that you are the brand owner. Read the marketplace's current product-identifier rules before you create listings; listing with an invalid or someone else's barcode can get listings removed.

Common scanning problems and their causes

ProblemLikely cause
Will not scan at allPrinted too small, no quiet zone, or red/low-contrast colours
Scans as the wrong productNumber not registered to you, or a typo in the digits
Scans only sometimesBars printed too thick or thin (ink spread), or a curved or glossy surface
"Invalid code" messageWrong check digit; regenerate from the first 12 digits

For labels printed on a thermal printer, print at the printer's native resolution and avoid scaling the barcode after placing it, which can change bar widths unevenly.

Keeping your numbers organised

Keep a simple register, a spreadsheet is enough, with one row per GTIN: the full 13-digit number, product name, size or variant, date assigned and status. Never reuse a GTIN for a different product, even after discontinuing the old one; retailers' systems may still hold the old product. A register also makes it easy to see how many numbers you have left in your GS1 allocation.

Frequently Asked Questions

Does the barcode store the price? ↓
No. It stores only the product number. Each shop links that number to its own price in its system.
Do I need a different barcode for each size and colour? ↓
Yes. Every variant a retailer sells separately needs its own GTIN.
Can I make an EAN-13 for books? ↓
Books use ISBN-13 numbers, which are EAN-13 barcodes starting with 978 or 979, issued by your national ISBN agency.
Can I print barcodes on an ordinary office printer? ↓
Yes, laser printers give good results on matt labels. Print at 100% scale and test-scan a few before printing a full batch.
What is the difference between GTIN and EAN? ↓
GTIN is the name of the number; EAN-13 is both the older name and the barcode symbol that carries a 13-digit GTIN.
Do services and digital products need barcodes? ↓
No. Barcodes are for physical items scanned in shops and warehouses.