🏷️ EAN-13 Barcode

12 digits → check digit · canvas bars · parity tables explained

Advertisement

An EAN-13 is 95 modules of bars encoding 13 digits, but only 12 are ever typed: the thirteenth is a modulo-10 check digit weighted 1,3,1,3… from the left, so a single mistyped digit or a transposed adjacent pair changes the weighted sum and every scanner rejects the code. The first digit is never drawn as bars — it hides in the parity pattern of the left half (which of its six digits use the mirrored G pattern instead of L), which is what lets the same six digits encode two different ways and lets a reader tell an upside-down barcode from a right-way-up one. This page computes the check digit, builds the module string from the published tables and paints it directly on a canvas.

—

Where a printed barcode can still fail you

The encoding above is exact, but a printed code lives or dies on optics: the quiet zone of at least nine empty modules on each side, a bar-width variation under about 15% (cheap inkjet dot gain doubles thin bars and scanners read 11 for 1), and contrast that survives the shelf light — black on white, never the reverse, because most readers illuminate with a red laser and red ink reads as white. At 2 px per module the narrowest bar is 0.33 mm on a 96 dpi screen, which is under most printers’ honest capability; for print, redraw at 3–4 px per module (the EAN spec’s nominal 37.29 mm width for the full 95 modules at 0.33 mm each). And the deepest trap is not technical at all: reuse a number from the internet and two products collide in every till that trusts GS1 — test barcodes should visibly say they are tests, which is why the random button produces codes rather than letting you paste a real one quietly.

Part of Everyday Tools. Like everything on tukuk.org: free, no account, no tracking.

Advertisement
Advertisement