Worked example: the check digit of an EAN-13 barcode

Take the 12 digit number 590123412345, the start of a real EAN-13 barcode for a product made in Poland. The 13th digit is not chosen, it is calculated, and the calculation is the reason a scanner can tell a misprinted barcode from a good one. Write the 12 digits out and number the positions from the left, starting at 1: 5 is position 1, 9 is position 2, 0 is position 3, 1 is position 4, 2 is position 5, 3 is position 6, 4 is position 7, 1 is position 8, 2 is position 9, 3 is position 10, 4 is position 11, and 5 is position 12. Add the digits in the odd positions: 5 plus 0 plus 2 plus 4 plus 2 plus 4, which is 17. Add the digits in the even positions: 9 plus 1 plus 3 plus 1 plus 3 plus 5, which is 22, and multiply by 3, which gives 66. Add the two results: 17 plus 66 is 83. The check digit is the number that takes the total up to the next multiple of 10. The next multiple of 10 after 83 is 90, and 90 minus 83 is 7. The full barcode number is therefore 5901234123457, and the final 7 is the check digit. If a printer smudges one digit, the sum changes, the total no longer lines up with the check digit, and the scanner refuses the code instead of ringing up the wrong product. That is the whole point: the check digit is a small piece of arithmetic that catches printing errors before they reach a customer.

Barcode sizes and quiet zones

A barcode is a physical object, not just a number, and its printed size decides whether a scanner can read it. The quiet zone, the blank space on each side, is part of the code, not decoration.

Format Characters Typical use Nominal width
EAN-13 13 digits Retail products worldwide 37.29 mm wide, 22.85 mm tall
UPC-A 12 digits Retail products in North America 37.29 mm wide, 25.91 mm tall
Code 128 Letters, digits, symbols Logistics labels, asset tags Varies with the data length
Code 39 Letters, digits, a few symbols Industrial labels, ID badges Varies with the data length
QR Code Thousands of characters Web links, tickets, payments At least 2 cm by 2 cm for phones

Anatomy of an EAN-13 barcode Quiet zone Bars, 95 modules wide in total Quiet zone The human readable digits sit under the bars. The first digit, 5, stands alone on the left. The quiet zone must be at least 10 modules wide, about 3.3 mm at standard size.

Common mistakes

The first mistake is printing a barcode too small. An EAN-13 at 80 percent of its nominal size is 29.8 mm wide, and many cheap scanners start failing below that. The GS1 standard allows 80 to 200 percent of nominal size, so print at 100 percent unless the label genuinely has no room. The second mistake is printing black bars on a coloured background. Scanners read contrast, and dark red bars on a white background can look blank to a red laser scanner, because the scanner sees red as light. Black bars on white is the only combination that works everywhere. The third mistake is trimming the quiet zone to save space. A barcode with text or a border touching the bars will not scan, because the scanner cannot tell where the code starts. The fourth mistake is inventing a retail barcode number. A real EAN-13 starts with a GS1 company prefix that a business buys from GS1, and a made up number may belong to another company, which means the wrong product gets rung up. This generator is fine for labels, tickets, library books and internal stock, but a product sold in a shop needs a genuine GS1 prefix. The fifth mistake is a low resolution print. A barcode printed at 150 dots per inch has fuzzy bar edges, and a scanner may read a narrow bar as a wide one. Print at 300 dots per inch or higher.

Limitations

This generator draws barcodes from the data you type. It cannot give you a GS1 company prefix, register a product, or check whether a number is already in use by another company. That registration happens through GS1, and it is a paid process. The generator cannot test whether a printed barcode will scan, because scanning depends on the printer, the paper, the light in the shop and the scanner itself. It cannot fix a number with a wrong check digit, though it can calculate the right one for you, and it cannot generate a barcode from a photograph of an existing code. The download is a plain image file: it carries no product name, price or stock data, because a one dimensional barcode stores only the number, and all the product information lives in the shop’s database, not in the bars. If you need a code that stores a web link or a block of text, use a QR code instead, which is a two dimensional format built for that job.

Sources

GS1 General Specifications, barcode size, quiet zone and check digit rules (accessed November 2026). EAN and UPC symbology standard, ISO/IEC 15420 (accessed November 2026). GS1 check digit calculator and guidance, GS1 (accessed November 2026).