Barcode Generator

Type a GTIN and get a print-ready barcode. The check digit is validated first — a barcode that encodes the wrong number is worse than no barcode at all.

🔒 Your data never leaves your browser — the symbol is generated here, not fetched from a server.

How a barcode encodes a number

An EAN-13 symbol is 95 modules wide. Three of them form the start guard, five the centre guard, three the end guard; the remaining 84 carry the twelve visible digits as seven modules each. The thirteenth digit — the first one you see printed — is not drawn at all.

It is encoded in the parity pattern of the left half: each of the six left digits is drawn using one of two tables, and which table each one uses spells out the leading digit. That is why EAN-13 fits thirteen digits into twelve digits' worth of bars, and why a scanner can read the symbol from either direction and still know which way round it is.

Why the check digit is validated before drawing

A barcode generator that draws whatever you type will happily produce a label that scans as a different product, or as nothing at all. Since the check digit is derived from the other digits, a mismatch means one of them is wrong — so this tool stops and tells you the correct number instead of printing the mistake a few thousand times.

Printing that actually scans

How we know the encoding is right

Encoding tables are easy to copy incorrectly and hard to eyeball. Our test suite includes an independently written decoder: every build encodes thousands of random codes and decodes them back, and any error in the tables breaks that round-trip immediately. The structural rules of the standard — odd and even parity sets, four runs per digit, 95 modules for EAN-13 — are asserted separately.

When this tool refuses to draw a symbol (5 rules)

BAR-I01 Digits only

These symbologies encode decimal digits and nothing else. A letter, space or hyphen in the input usually means the value was copied along with formatting, or that it is not a GTIN at all.

Fix: Strip everything that is not a digit and check the length again.

Source: Derived from the module-encoding tables of each symbology, which this package implements and self-proves: the generator ships an independent decoder, and our tests round-trip thousands of random values through encode and decode to show the tables are right.

BAR-L01 Length must match a symbology

The length of the number selects the symbology: EAN-13 takes 13 digits, UPC-A takes 12 digits, EAN-8 takes 8 digits, ITF-14 takes 14 digits. Any other length cannot be drawn as a linear barcode of these kinds.

Fix: Check whether a leading zero was lost — an 11-digit value is very often a UPC-A that a spreadsheet trimmed.

Source: Derived from the module-encoding tables of each symbology, which this package implements and self-proves: the generator ships an independent decoder, and our tests round-trip thousands of random values through encode and decode to show the tables are right.

BAR-C01 Check digit must be correct

The generator refuses to draw a symbol whose check digit does not match. This is the rule that matters most: a barcode drawn from a wrong number scans perfectly and resolves to the wrong product — or to nothing — and you only find out after it has been printed onto packaging.

Fix: Recalculate the check digit before generating, rather than after printing.

Source: Derived from the module-encoding tables of each symbology, which this package implements and self-proves: the generator ships an independent decoder, and our tests round-trip thousands of random values through encode and decode to show the tables are right.

BAR-Q01 Quiet zones are part of the symbol

The blank margin either side of the bars is not decoration — scanners need it to find the start and end of the code. The rendered symbol includes it, so a barcode cropped tight to the bars will read unreliably even though it looks complete.

Fix: Keep the whitespace around the symbol when placing it in artwork.

Source: Derived from the module-encoding tables of each symbology, which this package implements and self-proves: the generator ships an independent decoder, and our tests round-trip thousands of random values through encode and decode to show the tables are right.

BAR-S01 The encoding is self-proven

The module tables that turn digits into bars are the one place a generator can be silently wrong, because a wrong table still produces a plausible-looking barcode. This package ships an independent decoder and round-trips random values through encode and decode in its tests, so the tables are demonstrated rather than assumed.

Source: Derived from the module-encoding tables of each symbology, which this package implements and self-proves: the generator ships an independent decoder, and our tests round-trip thousands of random values through encode and decode to show the tables are right.

A generator that happily draws a wrong number is more dangerous than one that errors, because the mistake is only discovered after the packaging is printed. These are the conditions under which this one declines.