The barcode you need depends on where it will be scanned. Products sold in shops use EAN-13 (worldwide) or UPC-A (mainly the US and Canada), with a number licensed from GS1. Outer cartons use ITF-14. Shipping labels, inventory and asset tags use Code 128, which can hold letters and numbers in a compact symbol, or the older Code 39. This guide compares the common types, explains check digits and quiet zones, and tells you when you need GS1 and when you do not.
- EAN-13 and UPC-A are retail barcodes. The number inside (a GTIN) must come from GS1 if the product will be sold through shops or marketplaces.
- Code 128 is the best general-purpose barcode for your own labels: full ASCII text, compact and very reliable.
- ITF-14 marks cartons and cases; EAN-8 and UPC-E are short versions for small packs.
- EAN, UPC and ITF-14 end with a check digit calculated from the other digits, so most misreads are caught.
- Leave a blank quiet zone either side, use dark bars on a light background and test-scan before printing in bulk.
The common barcode types at a glance
| Type | Characters | Length | Typical use |
|---|---|---|---|
| EAN-13 | Digits | 13 (12 + check digit) | Retail products worldwide; books (ISBN as EAN-13) |
| UPC-A | Digits | 12 (11 + check digit) | Retail products in the US and Canada |
| EAN-8 | Digits | 8 (7 + check digit) | Very small retail packs |
| UPC-E | Digits | 8 (a compressed UPC-A) | Small packs in North America |
| ITF-14 | Digits | 14 (13 + check digit) | Outer cartons and cases in warehouses |
| Code 128 | All 128 ASCII characters | Variable | Shipping labels, inventory, asset tags, tickets; GS1-128 in supply chains |
| Code 39 | A–Z, 0–9, space, - . $ / + % | Variable | ID badges, industrial and automotive parts, defence logistics |
| Codabar | 0–9 and - $ : / . + | Variable | Older systems in libraries, blood banks and parcel services |
All of these are one-dimensional (linear) barcodes: the information is in the widths of the bars and spaces, and a laser or camera scanner reads them in a single line. Two-dimensional codes such as QR codes and Data Matrix store data in a grid, hold far more and can be read from any angle; more on them below.
EAN-13 and UPC-A: retail barcodes
The barcode on almost every product in a supermarket is an EAN-13 or a UPC-A. Both encode a GTIN (Global Trade Item Number), the number that a shop's till looks up to find the product's name and price. The two are closely related: a 12-digit UPC-A is the same as a 13-digit EAN-13 with a leading zero, and since 2005 retailers in the US and Canada have been expected to scan EAN-13 too, so either works almost everywhere.
An EAN-13 number has four parts:
- GS1 prefix (the first two or three digits): shows which national GS1 organisation issued the number. It does not say where the product was made, a common myth: a product made in one country can carry a number licensed in another.
- Company prefix: identifies the brand owner who licensed the numbers.
- Item reference: chosen by the company for each product variant (each size, flavour or colour needs its own GTIN).
- Check digit: the last digit, calculated from the others.
Books use an ISBN, which since 2007 has 13 digits starting with 978 or 979 and is printed as an EAN-13 barcode. EAN-8 and UPC-E are shortened versions for packs too small for a full barcode; EAN-8 numbers are allocated individually and sparingly.
When you need GS1
If a product will be sold through shops, supermarkets, pharmacies or most large online marketplaces, its EAN or UPC number must be licensed from GS1, the not-for-profit standards organisation behind retail barcodes, through your local GS1 member organisation. You get a company prefix (usually for an annual fee) and create GTINs from it. A barcode generator, including ours, only draws the barcode for a number you give it; it cannot issue or register numbers. Inventing a number or buying cheap resold numbers risks clashing with another company's product, and many retailers check GTINs against the GS1 registry.
You do not need GS1 for barcodes that never leave your own system: stock locations, internal SKUs, library or asset tags, event tickets or loyalty cards. Use Code 128 for those.
ITF-14: cartons and cases
Warehouses deal in boxes of products rather than single items. ITF-14 (Interleaved 2 of 5) encodes a 14-digit GTIN for those outer cases. The first digit, the packaging indicator, tells a box of 12 from a box of 24 of the same product, the next 12 digits usually repeat the product's GTIN without its check digit, and a new check digit is calculated over all 13. ITF-14 tolerates printing directly onto corrugated cardboard, and it is often printed with thick bearer bars around it that stop a scanner reading only part of the code.
Code 128: the general-purpose barcode
Code 128 can encode all 128 ASCII characters (letters, digits, punctuation and control characters), so it suits order numbers, serial numbers, tracking codes and short text. It switches between three code sets: A (upper case and control characters), B (upper and lower case) and C, which packs two digits into each symbol, making long numbers very compact. A built-in check character (modulo 103) catches misreads, and most generators add it automatically.
GS1-128 is a GS1 application of Code 128 used on pallet and shipping labels. It strings data fields together with Application Identifiers in brackets, such as (01) for the GTIN, (17) for a use-by date and (10) for a batch number, so one barcode can carry several pieces of information.
Code 39: simple and widely supported
Code 39 dates from the 1970s and encodes 43 characters: upper-case letters, digits, space and - . $ / + %. Each character is self-contained and the barcode starts and ends with an asterisk, which makes it easy to print and decode, and it has long been used for ID badges, industrial parts and defence logistics. The cost is size: Code 39 is much wider than Code 128 for the same data. A modulo-43 check character is optional. For new systems Code 128 is usually the better choice; use Code 39 when existing equipment or a customer requires it.
How check digits work
EAN, UPC and ITF-14 use the same GS1 modulo-10 check digit. Starting from the rightmost digit (before the check digit), multiply digits alternately by 3 and by 1, add the results, and the check digit is the number that brings the total up to the next multiple of ten: check digit = (10 − sum mod 10) mod 10.
Worked example (EAN-13): for 400638133393, from the right: 3×3 + 9×1 + 3×3 + 3×1 + 3×3 + 1×1 + 8×3 + 3×1 + 6×3 + 0×1 + 0×3 + 4×1 = 9 + 9 + 9 + 3 + 9 + 1 + 24 + 3 + 18 + 0 + 0 + 4 = 89. The next multiple of ten is 90, so the check digit is 1 and the full number is 4006381333931.
Worked example (UPC-A): for 03600029145 the weighted sum is 58, so the check digit is 2: 036000291452.
This catches every single wrong digit and most cases of two neighbouring digits swapped. A scanner that reads a wrong check digit rejects the scan instead of ringing up the wrong product. The barcode generator calculates the check digit for you, shows the working, and warns if a number you enter has the wrong one.
Printing barcodes that scan
- Quiet zone: leave blank space on both sides. EAN-13 needs at least 11 modules (narrowest bar widths) on the left and 7 on the right; Code 128 and Code 39 need at least 10 modules. Text or a box edge too close is a common reason for failed scans.
- Size: the standard EAN-13 is about 37.3 mm wide (including quiet zones) by 25.9 mm high at 100%, and GS1 allows roughly 80% to 200% of that size. Shrinking the height (truncation) makes scanning harder.
- Contrast: dark bars (black, dark blue, dark green) on a white or light background. Red bars are invisible to many red-light laser scanners, and light bars on a dark background often fail.
- No stretching: scale proportionally and print at 100% (turn off "fit to page"), or the bar widths change.
- Resolution: use vector SVG for print layouts and high-resolution PNG for labels; blurry edges cause misreads.
- Test first: scan a printed sample with a phone app or the scanner you will use before printing a full run.
Barcodes vs QR codes
Linear barcodes are cheap, fast and supported by every retail and warehouse scanner, but they hold only a short string. QR codes and other 2D codes hold hundreds of characters, can be read by any phone camera and still work when partly damaged, which makes them the right choice for web links, Wi-Fi details or contact cards. Retail is moving towards 2D too: GS1 is running an industry programme, often called Sunrise 2027, for shop scanners to read 2D codes that carry a GTIN plus extra data such as batch and expiry dates. For now, retail products still need a linear EAN or UPC. To make a code for a link, use the QR code generator.
Which barcode should you use?
- Selling a product in shops or on marketplaces: EAN-13 (or UPC-A in North America) with a GS1-licensed number.
- Cartons of that product: ITF-14 or GS1-128.
- Your own stock, assets, tickets or documents: Code 128.
- Equipment that only reads Code 39: Code 39.
- A link, text message or contact card for phones: a QR code.
More free generators and converters are in everyday tools.
Frequently asked questions
What is the difference between EAN and UPC?
UPC-A has 12 digits and is used mainly in the US and Canada; EAN-13 has 13 digits and is used worldwide. A UPC-A is an EAN-13 with a leading zero, and modern scanners read both.
Do I need to buy barcodes from GS1?
For products sold through retailers or most large marketplaces, yes: the EAN or UPC number must be licensed from GS1. For internal use, such as inventory or asset tags, you can create your own Code 128 barcodes without GS1.
Does the start of an EAN-13 show the country of origin?
No. The first digits show which national GS1 organisation issued the company prefix, not where the product was made.
Which barcode is best for inventory?
Code 128. It encodes letters and numbers, is compact, has a built-in check character and is read by virtually every scanner.
How is an EAN-13 check digit calculated?
Multiply the first 12 digits alternately by 1 and 3 (from the left; equivalently 3 and 1 from the right), add them, and take the amount needed to reach the next multiple of 10. For 400638133393 the sum is 89, so the check digit is 1.
Can a barcode store a website address?
Code 128 can technically hold a short URL, but phones will not open it as a link. Use a QR code for web addresses.