Barcode formats, check digits and printing them right
Which barcode format suits which job, how the GS1 check digit is worked out, where a retail number has to come from, and the print sizes that scan.
Last reviewed · 1,682 words
In short
- Use Code 128 with your own reference for shelves, bins and asset tags. Keep EAN-13, UPC-A, EAN-8 and ITF-14 for GS1 numbers you have licensed.
- In India, retail GS1 numbers start with 890 and are issued by GS1 India. A made-up EAN is for use inside your own business only.
- The check digit brings the 3-1 weighted sum up to the next multiple of 10. It catches any single wrong digit, but not two neighbouring digits that differ by 5 swapped round.
- An ITF-14 carton code gets a new check digit. It is not the EAN-13 with a digit added in front.
- Choose the printer resolution first, so each bar is a whole number of dots, then print at 100% scale rather than fit to page.
- Measure one printed code with a ruler and scan it on the device that will read it before printing the run.
You have a list of stock codes, product numbers or carton numbers, and you need barcodes a scanner will read. That depends on three things: the format, whether the number is valid, and whether the bars are printed at the right size.
Which format fits which job
Code 128 and Code 39 hold your own text, such as a SKU. EAN-13, UPC-A, EAN-8 and ITF-14 hold GS1 numbers: a fixed count of digits ending in a check digit.
| Format | Holds | Use it for | Quiet zone, in bar widths |
|---|---|---|---|
| Code 128 | Keyboard characters, up to 80 here | SKUs, bin labels, asset tags | 10 each side |
| Code 39 | Capitals, digits, space and - . $ / + %, up to 80 here | Older systems that ask for it | 10 each side |
| EAN-13 | 13 digits | Retail products | 11 left, 7 right |
| UPC-A | 12 digits | Retail products sold in the USA or Canada | 9 each side |
| EAN-8 | 8 digits | Packs too small for an EAN-13 | 7 each side |
| ITF-14 | 14 digits | Outer cartons that never pass a shop till | 10 each side |
The quiet zone is the blank margin that tells a scanner where the code starts, so keep borders and text out of it. The figures are GS1's, and ISO/IEC 16388's for Code 39; for Code 128 the tool uses GS1's figure for GS1-128. If the code only has to work inside your own business, Code 128 with your existing reference is the simpler choice.
Where a retail number has to come from
The bars are free to draw; the number is not. GS1's rules say a licence, Company Prefix or individual number must not be sold, leased or given to another company.
GS1 India says Indian GS1 numbers start with 890, that it has the exclusive right to issue them, and that businesses selling through retail chains or e-marketplaces must get GS1 barcodes. It says it appoints no agents or intermediaries. Its Terms of Use grant a non-transferable licence that is renewed each year, and say "890 with barcode" is protected under the Trade Marks Act, 1999, with a penalty of ₹10,000 for a lapsed or cancelled subscriber and ₹20,000 for someone who never registered, plus costs and compensation.
A number you make up may already belong to someone else's product, so use it only inside your own business. GS1 reserves some prefixes: 04 for restricted circulation within a company, 952 for demonstrations and examples, and 978–979 for books. A correct check digit shows that a number is well formed, not who owns it.
Working out the GS1 check digit
Every fixed-length GS1 number ends in a check digit calculated the same way. Take the digits before it and, starting from the rightmost, multiply by 3, 1, 3, 1 and so on leftwards. Add the products, then:
check digit = (10 − (sum mod 10)) mod 10
For 400638133393:
4×1 + 0×3 + 0×1 + 6×3 + 3×1 + 8×3 + 1×1 + 3×3 + 3×1 + 3×3 + 9×1 + 3×3 = 89
The next multiple of ten is 90, so the check digit is 1 and the full EAN-13 is 4006381333931. GS1's own worked example, 629104150021, sums to 57 and gets a 3.
Any single wrong digit is always caught. Weights 1 and 3 share no factor with 10, so changing one digit never moves the sum by a multiple of 10. Swapping two neighbouring digits moves it by twice their difference, which is a multiple of 10 when they differ by 5. So 4006831333931, with the 3 and 8 swapped, passes, while 4003681333931, with the 6 and 3 swapped, fails: the tool says the last digit should be 7.
One algorithm across four formats
The weights count from the right, so a 0 in front changes nothing. The UPC-A 036000291452 and the EAN-13 0036000291452 share a check digit, and EAN-13 numbers starting with 0 are reserved for UPC numbers.
| Format | You enter | Weighted sum | Tool adds | Full number |
|---|---|---|---|---|
| UPC-A | 03600029145 | 58 | 2 | 036000291452 |
| EAN-8 | 9638507 | 86 | 4 | 96385074 |
| ITF-14 | 1540014128876 | 97 | 3 | 15400141288763 |
Enter a number one digit short and the tool adds the check digit; enter it in full and it is checked. The trap is a whole UPC-A pasted under EAN-13, or a number whose leading 0 Excel dropped: it gains a digit it should not have. When a short number already ends in a valid check digit, the tool says it may be complete; about one in ten does so by chance. A number Excel shows as 8.90123E+12 is refused: format the column as Number with 0 decimal places.
An ITF-14 carton code gets a new check digit. It is the packing indicator (1 to 8), the first 12 digits of the EAN-13, then a fresh check digit. Indicator 1 on 4006381333931 gives 1400638133393, which sums to 92, so the carton code is 14006381333938, ending in 8, not 1.
Bar width and printer dots
The narrowest bar is the X-dimension, and everything else in the symbol is a multiple of it. GS1's retail figures for EAN-13:
| EAN-13 | Minimum | Nominal | Maximum |
|---|---|---|---|
| X-dimension | 0.264 mm | 0.330 mm | 0.660 mm |
| Bar height | 18.28 mm | 22.85 mm | 45.70 mm |
| Width with quiet zones | 29.83 mm | 37.29 mm | 74.58 mm |
The width is 113 × X. The tool scales the height with minimum height = 22.85 × X ÷ 0.330, which reproduces all three heights. GS1 allows 0.249 to 0.264 mm only for on-demand printing on thermal or laser printers.
A printer cannot draw part of a dot, so each bar is a whole number of dots: X = dots × 25.4 ÷ DPI.
| Printer | Dots per bar | X | EAN-13 bar height the tool sets |
|---|---|---|---|
| 203 DPI | 3 | 0.375 mm | 26 mm |
| 300 DPI | 4 | 0.339 mm | 23.5 mm |
| 600 DPI | 8 | 0.339 mm | 23.5 mm |
At 203 DPI, 2 dots would be 0.250 mm, inside the on-demand band but under the general minimum, so the tool uses 3 and raises the height to 25.99 mm, rounded up to 26. Choose the printer resolution first, because the bar width, the height and the file all follow from it.
Cutting the bars short
Release 26.0 of the GS1 specification, the current published edition, does not allow EAN/UPC bars below the minimum height for the X-dimension used. A change ratified in June 2026 (GSCN 26-144, going into Release 27.0) allows truncation for items scanned at a general retail till and not in general distribution, but not by more than 60% of that minimum height, only when a full-height symbol is impossible, and with the tallest possible bars printed.
The tool starts at the full GS1 height and warns, rather than blocks, below it. If you truncate, test the code on the till scanner that will read it. For Code 39, ISO/IEC 16388 recommends at least 5.0 mm or 15% of the symbol's width, whichever is greater.
ITF-14 on outer cartons
GS1's figures for ITF-14 are an X-dimension from 0.495 mm to 1.016 mm, bars at least 31.75 mm tall, and bearer bars unless they cannot be printed. The sources conflict on the target X: GS1's specification table gives 0.495 mm, while a worked example in the same document uses 1.016 mm.
The width, quiet zones included, is W = (P(4N + 6) + N + 6)X + 2Q, with 7 character pairs. At 300 DPI the tool uses X = 0.508 mm (6 dots), N = 3 and Q = 10X: (7 × 18 + 9) × 0.508 + 10.16 = 78.74 mm.
Code 128 or Code 39 for your own labels
A Code 128 character is 11 bar widths, the stop 13, and digits pack two to a character. SKU-1001 is start, S, K, U, -, a switch to digits, 10, 01, check character and stop: 11 + 44 + 11 + 22 + 11 + 13 = 112. With 10 each side that is 132 × 0.254 mm = 33.53 mm at 300 DPI. The check character, (Σ value × weight) mod 103, is added for you.
Each Code 39 character has 5 bars and 4 spaces, 3 of them wide, with a gap between characters and a * at each end. ISO/IEC 16388 gives W = (C + 2)(3N + 6)X + (C + 1)I + 2Q. For the same 8 characters as the tool draws them (N = 3, gap = X, Q = 10X), W = 150X + 9X + 20X = 179X, or 45.47 mm. The same label comes out about 12 mm wider in Code 39. It has no small letters; the tool turns them into capitals.
Neither format can hold Hindi or other Indian-script text. For a web address, a QR code is the usual choice.
Printing at true size and testing the scan
PNGs carry their resolution and SVGs state their size in millimetres, so Word and label software place them at the size shown. An EAN-13 at the tool's usual 300 DPI size measures 39.96 × 28.70 mm, digits and margins included.
- Print one code on the real printer and label stock, at 100% scale, not fit to page.
- Measure it. A different width means something scaled it.
- Scan it with the device that will read it in use, not only a phone.
- Check that the digits returned match your list, check digit included.
Only then print the rest.
What this tool assumes
- It draws barcodes and does not issue numbers. It cannot tell whether a number is licensed, and makes no claim that a retailer or marketplace will accept a code.
- Up to 500 codes per run; later lines can be loaded for the next run.
- Sizes start at the GS1 figures for the format; sizes outside GS1 or ISO figures bring a warning, not a block.
- One quiet-zone number covers both sides.
- Code 128 and Code 39 take printable keyboard characters only, up to 80.
- The print sheet uses the browser's print dialog, with 10 mm margins, 5 mm gaps and no label-sheet layouts.
- EAN-13, UPC-A, EAN-8 and ITF-14 output was decoded back in testing; Code 128 and Code 39 were checked for size and quiet zone only.
- Nothing is uploaded; your list stays on your device.