Which barcode format to use
A barcode is a number or a short piece of text written in bars. The formats differ in what they can hold and who expects to see them:
- Code 128 holds letters, digits, spaces and punctuation, and packs digits densely. It is the usual choice for your own labels: order numbers, asset tags, serial numbers and shipping labels.
- Code 39 holds capital letters, digits and a few symbols. It is older and wider than Code 128, but it is still read by many badge, parts and inventory systems, and it needs no check digit.
- EAN-13 is the 13 digit number on products sold in shops in most of the world.
- UPC-A is the 12 digit number used in the United States and Canada. Scanners read it as an EAN-13 with a 0 in front.
- EAN-8 is an 8 digit number for packages too small for an EAN-13.
- ITF-14 is a 14 digit number on the outer carton that holds several products. Its frame, the bearer bars, protects the edge bars when it is printed straight onto corrugated board.
If you only need to put your own ID on a label, use Code 128. The product formats only make sense when the number comes from GS1, the organisation that issues them.
Check digits: what they are and how the sum works
Most product barcodes end with one extra digit that is worked out from the digits before it. The scanner repeats the sum and throws the read away if the last digit does not match, so a misread digit does not turn into a wrong product.
For EAN-13, UPC-A, EAN-8 and ITF-14 the rule is the same. Start from the right and give the digits the weights 3, 1, 3, 1 and so on. Add up the results. The check digit is what brings that total up to the next multiple of 10.
For the EAN-13 number 590123412345 the digits from the right are 5, 4, 3, 2, 1, 4, 3, 2, 1, 0, 9, 5. Weighted, that is 15 + 4 + 9 + 2 + 3 + 4 + 9 + 2 + 3 + 0 + 27 + 5 = 83. The next multiple of 10 is 90, so the check digit is 7 and the full number is 5901234123457. Open Show the sum under the number to see this worked out for whatever you type.
This check catches any single wrong digit and nearly every pair of swapped neighbours. It misses a swap of two digits that are exactly 5 apart, such as 0 and 5.
Code 128 has a check character of its own, worked out from the symbols and added inside the bars, so you never type it. Code 39 has an optional one: add up the value of each character (0 to 9, then A to Z as 10 to 35, then - . space $ / + %) and divide by 43. The remainder picks the check character. This tool leaves it off unless you switch it on, because many scanners hand it to your software as an ordinary character.
Printing a barcode that scans
A scanner finds the start and end of a barcode by the blank space next to it. Each format asks for a minimum, counted in widths of the thinnest bar: 10 for Code 128, Code 39 and ITF-14, 11 on the left and 7 on the right for EAN-13, 9 for UPC-A and 7 for EAN-8. The tool warns when your blank border is below what the format needs.
Use dark bars on a light background. Many shop scanners use red light, so red or orange bars can look like blank paper to them. Light bars on a dark background are not readable by most scanners.
Print from the SVG where you can, and never stretch the picture in only one direction, because that changes the bar widths. For shop products GS1 gives 0.33 mm as the standard width of the thinnest bar and allows 80% to 200% of that, so 0.264 mm to 0.66 mm. Under Print size you can type a bar width and see how large the whole picture prints.
Some older laser scanners struggle to read a barcode that is shown on a phone or monitor screen. Camera based scanners handle screens well. If your barcode will be scanned from a screen, test it with the real scanner.
Numbers for products sold in shops
This tool draws the barcode for the number you give it. It does not register the number, and the picture is only a way of writing it down. For a product sold through shops or online marketplaces the number has to belong to you, and in practice that means a company prefix licensed from GS1. A made-up number can be the same as a real number someone else owns.
The first digits of an EAN-13 identify the GS1 office that issued the company prefix, not the country where the product was made. Numbers starting with 978 or 979 are ISBNs for books, 977 is used for magazines, and numbers starting with 2 are meant for use inside a single store or company. Numbers for your own internal use, such as stock in a warehouse, are fine to make yourself, and Code 128 is a better format for them.