Barcode types explained
Five linear barcode types cover almost every labelling job, but they are not interchangeable. This guide explains what each one can encode, how long it gets, how its check digit works, and which one a scanner, shop or marketplace will expect from you.
The five formats at a glance
The table compares the formats the bulk barcode generator makes. Length means the data you type, not the printed width.
| Format | What it can encode | Length | Check digit | Typical use |
|---|---|---|---|---|
| Code 128 | Letters, digits, punctuation and spaces | Any, but keep it short | Added automatically, never shown in the text | Stock, bins, assets, job tickets |
| Code 39 | 0-9, A-Z, space and - . $ / + % | Any, but wide per character | None (an optional mod 43 character exists) | Older systems, libraries, some industry labels |
| EAN-13 | Digits only | 12 digits + check digit | Mod 10, part of the number | Retail products worldwide |
| UPC-A | Digits only | 11 digits + check digit | Mod 10, part of the number | Retail products in the US and Canada |
| EAN-8 | Digits only | 7 digits + check digit | Mod 10, part of the number | Very small retail packs |
Code 128: the flexible default
Code 128 is the format to reach for when the barcode stays inside your own business: stockrooms, warehouse bins, equipment tags, job tickets. It holds upper- and lower-case letters, digits, punctuation and spaces, so an existing SKU or asset numbering scheme usually works as it is.
It is also compact. The standard has three character sets. Set B covers ordinary text, and Set C packs two digits into each symbol character, so a run of digits takes about half the width. The generator switches between them on its own whenever a run of four or more digits appears: in ASSET-000123 the letters and hyphen are drawn in Set B and the six digits in Set C.
Every Code 128 barcode ends with a check symbol calculated from all the other characters (modulo 103). Scanners use it to reject a misread. It never appears in the scanned value or in the text under the bars, so there is nothing for you to calculate.
Plain Code 128 is not the same as GS1-128 (formerly UCC/EAN-128), the logistics format that starts with a special FNC1 character and uses application identifiers such as (01) for a product number, (10) for a batch and (17) for an expiry date. If a customer's shipping manual asks for GS1-128, use label software that supports application identifiers. This tool draws plain Code 128.
Code 39: when an older system asks for it
Code 39 predates Code 128 and is still built into a lot of equipment, library systems and industry standards. Each character is drawn with nine bars and spaces, three of them wide, which is where the name comes from. That makes it easy to print and to read, but wide: the same value takes noticeably more room than in Code 128.
The character set has 43 characters: digits, capital letters, space and the six symbols - . $ / + %. The generator turns lower-case letters into capitals for you; anything else, such as an underscore or #, is rejected with a note. Every Code 39 barcode starts and ends with an asterisk, which scanners use to find the ends and do not pass on, so an asterisk cannot appear inside your value.
Some systems expect an optional modulo 43 check character at the end. This tool does not add one, so if your scanner is set to require it, switch that setting off or use Code 128 instead.
EAN-13, UPC-A and EAN-8: retail product numbers
These three formats carry GTINs (Global Trade Item Numbers), the numbers that identify a product at a checkout. They hold digits only and have a fixed length: 13 digits for EAN-13, 12 for UPC-A and 8 for EAN-8. The last digit is always a check digit.
UPC-A is the original North American format. Put a 0 in front of a UPC-A number and you have the equivalent EAN-13; the bar pattern is the same and only the printed digits are laid out differently. North American checkout systems have been expected to read EAN-13 since 2005, and most of the world prints EAN-13 only.
EAN-8 is for packs too small for an EAN-13 symbol, such as lip balm or chewing gum. GS1 issues EAN-8 numbers separately and only when the pack really is too small, so you cannot make one by shortening an EAN-13.
How the check digit is calculated
Take the number without its check digit. Starting from the rightmost digit, multiply every other digit by 3 and the rest by 1, then add up the results. The check digit is whatever brings that total up to the next multiple of 10. The rule is the same for EAN-13, UPC-A and EAN-8.
For the made-up EAN-13 body 503601234567, working left to right:
5×1 + 0×3 + 3×1 + 6×3 + 0×1 + 1×3 + 2×1 + 3×3 + 4×1 + 5×3 + 6×1 + 7×3 = 86
The next multiple of 10 is 90, so the check digit is 4 and the full number is 5036012345674. Type the 12-digit body into the generator and it adds the 4 for you. Type all 13 digits and it recomputes the check digit and flags the line if they differ. That catches every single wrong digit and most pairs of swapped neighbouring digits, the two most common typing mistakes.
When you need real GS1 numbers
A generator draws bars for any number you give it, but it cannot make a retail number genuine. EAN and UPC numbers are allocated through GS1, a not-for-profit standards body with an office in most countries. A company licenses a company prefix from its local GS1 office and numbers its own products under it.
That matters as soon as the code leaves your building:
- Shops and supermarkets expect the number on your pack to be registered to your company, and many will not list a product without one.
- Marketplaces check too. Amazon, for example, says it verifies product UPCs against the GS1 database.
- Resold numbers sold cheaply online are usually recycled from an old GS1 membership. They scan, but the GS1 record names the original company, not yours.
For codes that never leave your business, GS1 sets aside restricted circulation numbers. EAN-13 numbers that start with 2 (prefixes 20 to 29) are meant for use inside one company or shop, for example shelf-edge labels, in-store items without a manufacturer barcode, or a test system. 2000000001234 is such a number: type the body 200000000123 and the generator adds the final 4. Ask your till or scanner supplier which part of that range to use, because in many countries part of it is used for weighed items with the price built into the number.
Formats this tool does not make
- QR codes and Data Matrix are two-dimensional. They hold far more data, including web links, and phones read them with the camera. Data Matrix is common on small parts and medicine packs.
- ITF-14 goes on outer cartons of retail goods. It encodes a 14-digit GTIN and is usually printed with a thick bearer bar around it on corrugated board.
- GS1-128 carries shipping and traceability data such as batch numbers and expiry dates, as described above.
- PDF417 is a stacked format used on airline boarding passes and many ID cards.
Which one should you choose?
- Internal stock, bins, assets or tickets: Code 128.
- A scanner, database or customer specification that names Code 39: Code 39, with short values.
- Products sold in shops or online: EAN-13 (or UPC-A when a North American retailer asks for it), with numbers from your own GS1 licence.
- A pack too small for EAN-13: EAN-8, with a number issued by GS1.
- Shelf labels or in-store items that must look like retail barcodes: EAN-13 with a restricted circulation number.
Once the format is settled, read how to print barcode labels that scan for sizes, margins and printer settings.
Frequently asked questions
Can I make up my own EAN-13 or UPC numbers?
Only for use inside your own business, ideally with a restricted circulation number starting with 2. Anything sold through shops or marketplaces needs a number from a GS1 company prefix licensed to you.
Is UPC the same as EAN?
UPC-A is the 12-digit North American version. Add a leading 0 and it becomes the equivalent EAN-13 with the same bars. Print whichever format your buyer or retailer asks for.
Why is my Code 128 barcode shorter when the value is all digits?
Code 128 stores digits two at a time in Set C, so 12345678 needs only four data characters. Letters take one character each.
Does the scanner send the check digit?
For EAN and UPC, scanners normally send the full number including the check digit, because it is part of the product number. The Code 128 check symbol is never sent.