Skip to the tool
DevToolBench

EAN-13 Barcode Generator

EAN-13 barcodes as SVG or PNG, with the check digit.

12 or 13 digits
EAN-13 barcode for 4006381333931

4 006381 333931 — check digit 1 calculated and appended.

Drawing a barcode does not register the number. A GTIN is unique only when GS1 allocated it to your company; retailers check it against the GS1 registry. Print tests at 100% scale before a production run.

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Share this tool

What this tool does

This EAN-13 barcode generator turns a 12-digit number into a scannable retail barcode, adds the check digit, and lets you download the result as SVG or PNG. Type all thirteen digits and it checks the last one instead, telling you what it should have been if it is wrong. Everything is calculated in your browser; no number is sent anywhere.

The encoder is written against the GS1 General Specifications, not borrowed from a library: the left half uses the L and G code sets in the parity pattern chosen by the first digit, the right half uses the R set, the three guard patterns extend below the other bars, and the symbol keeps the standard quiet zones of 11 modules on the left and 7 on the right.

How to use it

  1. Type or paste the number. Spaces and hyphens are ignored, so you can copy it straight from a spreadsheet or a label.
  2. With 12 digits, the tool works as an ean 13 check digit calculator and appends the result. With 13, it validates the check digit you supplied.
  3. Choose the bar height, the size in pixels per module, and whether the digits are printed underneath.
  4. Download the ean-13 barcode svg for print and layout software, or the PNG for anything that only accepts bitmaps.

A barcode is not a registration

This is the part most people learn the expensive way. The barcode is only a picture of the number; the uniqueness of a gtin-13 barcode comes from GS1, the organisation that allocates company prefixes. When you license a prefix from your national GS1 office, every number you build from it is guaranteed not to clash with anyone else's product. Numbers bought from resellers or made up on the spot carry no such guarantee, and marketplaces increasingly reject listings whose GTIN does not belong to the brand selling the product.

Some ranges are legitimate without a licence, but only inside your own walls. Prefixes 20 to 29 are reserved for in-store use, such as variable-weight items priced at the deli counter, and are never unique outside the shop that printed them. Books use 978 and 979, the Bookland prefix that turns an ISBN into an EAN-13, and periodicals use 977 for the ISSN.

Getting it to scan

A barcode that reads on screen can still fail on the shelf. Print in black on white or on a pale background; red bars are invisible to the red light most scanners use. Keep the white margins either side — cropping the quiet zones is the commonest cause of a symbol that reads on some scanners and not others. Scale the whole barcode rather than stretching one dimension, and print a test at 100% before committing to a run of labels.

Related tools

Need unique identifiers for internal stock records rather than retail products? The UUID generator creates them without any registry. To fingerprint a file of product data before sending it on, use the hash generator.

Frequently asked questions

Does generating a barcode here give me a valid product number?

No. The tool draws whatever number you give it, correctly encoded, but it cannot make the number yours. A GTIN-13 is unique only because GS1 allocated its company prefix to one business. Marketplaces and large retailers check new listings against the GS1 registry, so an invented or resold number can get products rejected or delisted.

How is the EAN-13 check digit calculated?

Take the first twelve digits and multiply them alternately by 1 and 3, starting with 1 on the left. Add the products, and the check digit is whatever brings the total up to the next multiple of ten. For 400638133393 the weighted sum is 89, so the check digit is 1. The tool does this for you when you type twelve digits and verifies it when you type thirteen.

Should I download the SVG or the PNG?

The SVG, whenever the destination accepts vectors. It scales to any size without blurring the bar edges, which is what a scanner cares about. Use the PNG for tools that only take bitmaps, and pick a size of at least 3 pixels per module; for print, 10 pixels per module gives a 1,130-pixel-wide image that stays sharp at normal label sizes.

What is the difference between EAN-13, GTIN-13 and UPC-A?

GTIN-13 is the number; EAN-13 is the barcode symbology that carries it. UPC-A is the 12-digit North American format, and any UPC-A is an EAN-13 with a leading zero, which is why a scanner reads both as the same product.

How small can I print the barcode?

The GS1 nominal size is 37.29 mm wide including the quiet zones, and it may be scaled from 80% to 200%. Below 80% many retail scanners struggle. Never trim the bar height or crop the white margins to make it fit — the quiet zones are part of the symbol.

Related tools

Updated