GenerateRandomSearch

EAN-13 Barcode Generator

A barcode that merely looks like a barcode fails at the till rather than on the page, which is no use to anybody. The only check worth having is the one a scanner does: read the bars back and see what number comes out. That is what happens here — the pattern is drawn, then decoded from the drawing alone and compared with what went in.

What this generator does

Works out the check digit, encodes the number as ninety-five bars and spaces with the proper guard patterns, and draws it as a scalable image with the digits underneath.

How to use this tool

  1. Enter twelve digits, or thirteen if you already have the check digit.
  2. Draw the barcode and read the check digit worked out for you.
  3. Note that the first digit appears under the bars but is not drawn in them.
  4. Use the button to make up a number if you just want an example.

Understanding the controls

Number
Twelve digits, and the thirteenth is worked out. Give thirteen and the check digit is verified rather than replaced — a number with the wrong one is refused rather than quietly corrected.

Common use cases

  • Producing a barcode for a product number you already have
  • Working out the check digit for a twelve-digit number
  • Making a scannable example for testing a till or a scanner app
  • Understanding how a thirteen-digit number fits into twelve digits of bars
  • Checking that a number you were given is a valid EAN-13

How this generator works

The drawn pattern is decoded again from scratch — guards checked, each seven-module block matched against the digit tables, and the number reassembled. That single check catches a wrong digit table, a missing guard and a mis-set parity at once. It also catches the subtle one at the heart of the format: the first digit is never drawn anywhere. It is carried entirely by which of two codes each of the next six digits uses, so a barcode with the wrong pattern scans as a different product altogether.

Randomness and fairness

Only the made-up number is random, drawn from the browser's secure generator. The bars themselves are not: a given number always produces exactly the same pattern.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • EAN-13 only. UPC-A, EAN-8, Code 128 and the two-dimensional codes are different formats.
  • The number is not checked against any product database — a valid barcode is not necessarily an assigned one.
  • Printing a barcode small or on a poor printer can make it unscannable however correct the pattern is.
  • No quiet-zone markers are drawn, and scanners want clear space either side of the bars.

Privacy and your data

The barcode is drawn in your browser. No number is transmitted or stored.