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.
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
| Format | Holds | Use it for |
|---|---|---|
| EAN-13 | 13 digits | Retail products sold outside North America |
| UPC-A | 12 digits | Retail in the US and Canada (a UPC-A is an EAN-13 with a leading 0) |
| Code 128 | Letters, digits, symbols | Internal stock codes, shelf labels, asset tags, shipping |
| QR code | Up to thousands of characters | Links, 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
| Problem | Likely cause |
|---|---|
| Will not scan at all | Printed too small, no quiet zone, or red/low-contrast colours |
| Scans as the wrong product | Number not registered to you, or a typo in the digits |
| Scans only sometimes | Bars printed too thick or thin (ink spread), or a curved or glossy surface |
| "Invalid code" message | Wrong 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.