Barcodes look interchangeable: a row of black bars with some digits underneath. They are not. Each type is a separate standard with its own alphabet, its own length rules and its own place in the world. A code that scans perfectly on a warehouse shelf may be rejected by a supermarket till, and a number you invented for a product may collide with one that belongs to somebody else.
The Barcode Generator follows the rules below and reports problems as you type.
One-dimensional and two-dimensional codes
Traditional barcodes are one-dimensional: data runs left to right in the widths of bars and gaps, and a scanner reads a single line across them. That makes them fast and cheap to scan, and it limits them to a short string, usually a number or a short identifier. QR codes and their relatives are two-dimensional and hold far more, including web addresses. For a product number, a shelf location or an asset tag, a linear barcode is still the norm because every till, handheld scanner and inventory system understands it. If you need a link or a contact card, use the QR Code Generator instead, and read how to make a QR code that scans before printing.
The main barcode types
| Type | Characters | Length | Typical use |
|---|---|---|---|
| Code 128 | All 128 ASCII characters | Any | Shipping labels, inventory, asset tags |
| EAN-13 | Digits | 13 | Retail products outside North America |
| UPC-A | Digits | 12 | Retail products in the US and Canada |
| EAN-8 | Digits | 8 | Very small retail packages |
| ITF-14 | Digits | 14 | Cartons and cases |
| Interleaved 2 of 5 | Digits | Even number | Logistics, film rolls |
| Code 39 | Capitals, digits and a few symbols | Any | Industry, defence, asset labels |
| Codabar | Digits and a few symbols | Any | Libraries, blood banks, parcel services |
| Pharmacode | A whole number from 3 to 131070 | — | Pharmaceutical packaging |
Code 128
Code 128 is the general-purpose choice. It encodes the full ASCII set, and it switches between three internal character sets to stay compact. One of them packs two digits into every symbol, so a long numeric string is roughly half as wide as the same digits encoded one character at a time. It includes its own error check automatically, which is why a mistyped character rarely produces a valid but wrong read. For anything you define yourself, this is the default to pick.
Code 39
Code 39 is older and simpler. It accepts capital letters, digits and a few symbols, and the characters are drawn wide, so labels are longer than the same text in Code 128. Its strengths are that it is easy to print on any equipment and widely supported in industrial systems. If you have a free choice, Code 128 is more compact, but Code 39 is not wrong.
Interleaved 2 of 5 and ITF-14
Interleaved 2 of 5 stores digits in pairs, one digit in the bars and the next in the spaces between them, which is why it needs an even number of digits. ITF-14 is a fixed-length version for shipping cartons. Its 14 digits form a trade item number whose first digit indicates the packaging level, and the last is a check digit. These codes are printed on rough corrugated board, so they use thick bars and a surrounding frame.
What the digits in a retail barcode mean
An EAN-13 is not a random number. It has a structure defined by GS1, the organisation that runs the system:
- The prefix and company number at the start identify the company that licensed the numbers. This part is assigned to you and is the reason numbers cannot be made up.
- The item reference in the middle is chosen by the company to identify one product and pack size.
- The check digit at the end is calculated from all the other digits.
A UPC-A is the same thing with 12 digits, and it can be written as an EAN-13 by adding a zero at the front. Books use the prefixes 978 and 979, with the ISBN inside the barcode. Numbers beginning 20 to 29 are reserved for use inside a single shop, such as a price-weighed deli item, and must not be used on products that go to other retailers.
Calculating a check digit by hand
The check digit catches typing errors and misreads. The method is the same for EAN-13, UPC-A, EAN-8 and ITF-14. Take the digits before the check digit, and starting from the rightmost one, multiply alternately by 3 and 1. Add the products, then find the amount that brings the total up to the next multiple of 10. That amount is the check digit.
Here is the worked example for the 12 digits 590123412345, which give the EAN-13 5901234123457:
| Digit | 5 | 9 | 0 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 5 | 27 | 0 | 3 | 2 | 9 | 4 | 3 | 2 | 9 | 4 | 15 |
The products add up to 83. The next multiple of ten is 90, and 90 minus 83 is 7, so the full number is 5901234123457. If you enter a wrong last digit in the generator, it tells you what the correct one is, and if you enter one digit fewer it appends the right one for you.
Using a number you do not own
Generating a barcode image is easy, and a generator will happily draw any valid number. That does not mean the number is yours. Retail numbers are unique worldwide because each company is issued its own range, and two products carrying the same number cause mix-ups at the till and in stock systems. Many marketplaces and retailers check numbers against the GS1 registry and reject those that are not registered to the seller.
- Selling through shops or marketplaces: obtain your numbers from GS1 or your national GS1 member organisation.
- Internal use only: use Code 128 with your own scheme, so there is no chance of colliding with a real product.
- Mock-ups and design work: a correctly formed number is fine, as long as it is clearly a placeholder before printing.
Designing your own internal codes
When the codes are yours, a few rules save trouble later:
- Make each value unique and stable. Never reuse an id after an item is retired.
- Keep it short. Shorter values give wider bars for the same label width, which scan faster and more reliably.
- Avoid look-alike characters. The letter O and the digit 0, or I, l and 1, are easy to confuse when someone has to type a code by hand.
- Use a prefix for the kind of item. Something like
BIN-0142orAST-3307tells a person what they are scanning. - Do not encode personal data. Anyone with a phone can read a barcode.
For a run of labels, use the generator's batch mode: paste one value per line and download all the PNG files in a single ZIP.
Printing barcodes that scan
Scanning problems are almost always print problems. Keep these points in mind:
- Print at 100% scale. Stretching an image changes the ratio of the bars and can make it unreadable. The nominal size of an EAN-13, including its margins, is about 37 by 26 mm, and the standard allows scaling between 80% and 200% in proportion.
- Leave the quiet zones. The blank space on each side tells the scanner where the code starts. An EAN-13 needs about 11 module widths on the left and 7 on the right.
- Use dark bars on a light background. Black on white is best. Avoid red bars, because scanners with a red light see red as blank paper.
- Use vector output for large runs. SVG files stay sharp at any size. When you need PNG, export at a higher resolution than you think you need.
- Keep bars vertical on curved items, and give small labels enough height, since taller bars are easier to hit with a scanner beam.
When a barcode will not scan
| Symptom | Likely cause | Fix |
|---|---|---|
| Scanner beeps but shows the wrong number | Wrong type set in the scanner | Enable the type you used, or switch to a common one |
| Does not scan at all | No quiet zone, or low contrast | Add margin, use black on white |
| Scans only sometimes | Bars too thin for the printer | Widen the bars, print at higher resolution |
| Generator refuses the value | Wrong length or invalid check digit | Correct the digits as the message says |
| Scans as a different number | Image was stretched or resampled | Print at 100%, avoid blurry screenshots |
Choosing and checking a barcode
- Selling through retail? Use licensed EAN-13 or UPC-A numbers and ITF-14 on cartons.
- Labelling your own stock? Use Code 128 with a clear, unique scheme.
- Does the number have the right length and a correct check digit?
- Is the artwork printed at 100% with quiet zones and dark-on-light colours?
- Did you test-scan a printed proof with the actual scanner in use?



