Barcode generator and validator

Type the number and the page draws it: EAN-13, UPC-A or CODE-128. If the final digit is missing, the page computes it; if you supply a full number, it checks it and tells you when the digit is wrong instead of drawing something a scanner will reject.

EAN-13: 12 digits compute the check digit, 13 check it · UPC-A: 11 or 12 · CODE-128: text

You get two files. The SVG is vector, so it survives whatever size the print shop asks for without turning the bars into staircases. The PNG is already raster, ready to paste into a document, an email or a proof layout.

The other direction works too: paste a GTIN of 8, 12, 13 or 14 digits and press the check button to find out whether its last digit is the right one, with nothing drawn.

Nothing leaves the browser. The page calls no server, never uploads the number you type and keeps no history, so it still works if the connection drops after the page has loaded.

How to use

  1. Write the number in the field. EAN-13 takes 12 digits (the check digit is computed) or 13 (the last one is verified); UPC-A takes 11 or 12; CODE-128 takes text, not only digits.
  2. Pick the format in the list next to the field. The bars appear below immediately, with the human-readable number under them.
  3. Download the SVG for the print shop or the PNG for quick use. Both files carry exactly the same code.
  4. If all you want is to know whether a GTIN is well formed, type the digits and press “Check digit”: the page answers with the full number and the format that would draw it.

How the check digit is calculated

Walk the number from right to left, multiplying each digit by 3, 1, 3, 1…, add everything up, divide by 10 and take whatever is missing to reach the next multiple of 10. That remainder is the check digit, and the arithmetic is the same for all four GTIN lengths.

This is why a leading zero changes nothing: it adds nothing to the sum and shifts no weight. A 12-digit UPC-A is an EAN-13 with a zero in front of it — same bar widths, the same 95 modules.

CODE-128 does not use the GTIN digit at all: the symbol closes with its own control value, found by summing each symbol value times its position (1, 2, 3…) and taking the remainder of 103. The text itself is encoded as typed.

What this page does not do: it does not look up whether a company prefix exists in the GS1 register, because there is no key-free public source to ask; it does not promise a printed size, which depends on the module width and DPI of the file you download; and CODE-128 here takes printable text, with control characters only when Set A is in use.

Number (without the digit)Weighted sumCheck digit
EAN-13 590123412345837
UPC-A 03600029145582
EAN-8 9638507864
GTIN-14 1590123412345864

Frequently asked

What is the difference between EAN-13 and UPC-A?
The bar width is identical and both occupy 95 modules. UPC-A is an EAN-13 with a leading zero: it carries 12 digits instead of 13 and always uses L parity for the six left blocks, while EAN-13 switches between L and G depending on its first digit.
Why does my code not come out?
It is almost always one of three things: a digit is missing, the last digit is not the one the rule produces, or a character that is not a digit sits where only digits belong. The page refuses and names which one it is, rather than drawing a wrong code you discover at the till.
Can I put this on a product I sell?
The artwork is ready, but the number has to be yours: the company prefix is issued by GS1, and this page neither registers one nor queries their register. With a legitimate GTIN in hand, the bars generated here follow the published pattern table, which is what every reader expects.
Which file should I send to the printer?
The SVG. Because it is vector, the bars stay sharp when the file is scaled and the shop can resize it without resampling. It already carries the white quiet zone on both sides, which is the margin a scanner needs to find where the code starts. Print one proof at final size and pass it over a real reader anyway: the file carries bars and margin, not physical dimensions.

Related tools