Skip to content

Barcode generator

Code 128, EAN-13 and UPC-A barcodes as PNG or SVG.

Format

Size and text

Selling in shops? Retail EAN and UPC numbers are issued by GS1, and a shop's system checks them against GS1's records. A number you make up here is fine for your own shelves, labels and tickets, not for the retail channel. gs1.org

Check digit, worked out

Where the modules go

Bars are drawn on your device with the open-source jsbarcode library. Barcodes for products sold through shops need numbers issued by GS1.

Which barcode format should you use?

Use Code 128 if you just need to encode your own text or numbers, such as an order number, an asset tag or a ticket ID. It holds any ASCII text, packs numbers densely and is read by every scanner. Use an EAN or UPC format only when the number comes from GS1, because those are the product numbers shops scan at the till. ITF-14 is for cartons that hold retail items, Code 39 is an older format that is still common on badges and in some industries.

The six formats in this generator
FormatHoldsCheck digitUsed for
Code 128 Any ASCII text Automatic, inside the symbol Shipping labels, inventory, tickets
EAN-13 13 digits Last digit Retail products outside North America
EAN-8 8 digits Last digit Very small packs
UPC-A 12 digits Last digit Retail products in the US and Canada
Code 39 A-Z, 0-9 and - . space $ / + % Optional (modulo 43) IDs, badges, industrial labels
ITF-14 14 digits Last digit Cartons and cases

Source: symbology specifications; GS1 General Specifications for EAN, UPC and ITF-14.

The generator makes the bars on your device and never sends what you type anywhere. To put a web address instead of a product number into a scannable image, use the QR code generator. To print several codes on one sheet, put the downloaded PNGs into a PDF and print it at 100% scale.

How is a check digit worked out?

EAN-13, EAN-8, UPC-A and ITF-14 all use the same rule, the GS1 modulo-10 check. Number the digits from the right, multiply the 1st, 3rd, 5th and so on by 3 and the others by 1, add them up, and the check digit is whatever brings the total to the next multiple of 10. It catches every single-digit typing mistake and most swaps of two neighboring digits.

Worked example · the GS1 sample UPC-A 61414199999
Digit61414199999
Weight x3 x1 x3 x1 x3 x1 x3 x1 x3 x1 x3
Product 18 1 12 1 12 1 27 9 27 9 27

The products add up to 144. The next multiple of 10 is 150, so the check digit is 6, and the full number is 614141999996.

Sample numbers used in GS1 documentation
FormatWithout check digitCheckFull number
UPC-A 61414199999 6 614141999996
EAN-13 061414199999 6 0614141999996
ITF-14 1061414100041 5 10614141000415

Source: the sample company prefix 0614141 used throughout GS1 documentation; check digits calculated here.

Type the number without its check digit and the tool adds it. Type the full number and the tool checks it, and tells you what the last digit should have been if it is wrong. Code 128 works differently: its check symbol is calculated inside the bars and is never printed as a digit. Code 39 can carry an optional modulo-43 check character, which you can switch on above.

Barcodes for products sold in shops

A retail barcode is a number plus the bars that carry it. The number identifies a product and its brand owner, and it comes from GS1, the organization that issues company prefixes and keeps the rules. You join, are given a prefix, and number your own products from it. Retailers and marketplaces often check the number against GS1’s records, so a made-up EAN-13 with a perfect check digit can still be refused.

  • Numbers beginning 20 to 29 (and 02) are set aside for use inside one store or company, so they are safe for your own price labels.
  • Numbers beginning 978 and 979 are ISBNs, which come from the national ISBN agency.
  • A leading 0 on a 13-digit number means it is a 12-digit UPC-A with an extra zero.

Start at gs1.org, which lists the GS1 office in each country, and use GS1’s own check digit calculator to cross-check any number.

What do the bars of an EAN-13 mean?

The symbol is 95 narrow-bar widths (modules) wide: a 3-module start guard, six digits of 7 modules each, a 5-module centre guard, six more digits, and a 3-module end guard. The 13th digit, the first one, is not drawn as bars at all. It selects which of two bar patterns is used for each of the left-hand digits, and the scanner reads the pattern to recover the digit. That is why the first digit sits on its own to the left of the guard bars. The strip under the preview shows the same layout for the number you typed.

Size and printing

For EAN-13 and UPC-A, GS1 national offices give a nominal module width (the X-dimension) of 0.33 mm, with printing allowed between 80% and 200% of that size. Including the empty quiet zones the symbol is 113 modules wide, which gives the widths below.

EAN-13 size by magnification
MagnificationModule width, mmWidth with quiet zones, mm
80% 0.264 29.8
100% 0.330 37.3
150% 0.495 55.9
200% 0.660 74.6

Source: GS1 Ireland EAN-13 page (nominal 0.330 mm, 80% to 200%); widths calculated as 113 modules.

The tool shows the printed width of your PNG at 300 dpi under the download button. As a rule, keep the bar width in whole pixels, export at 3x or more for print, and print at 100% scale. Resizing a PNG with smoothing blurs the bar edges, which is the most common cause of a code that scans on screen but not on paper. The SVG has no pixels to blur and is the best choice for print.

Why a barcode will not scan

  • No quiet zone. The white space on both sides is part of the code. Keep the margin at 10 modules or more.
  • Low contrast. Dark bars on a light background. Red or pale colors on white fail with many scanners, and the tool warns you.
  • Too small. Below about 0.25 mm per module, many scanners struggle. US label stock is sold in inches; the length converter turns these millimeter widths into inches.
  • Stretched or squashed. Scaling the width and height separately changes the bar ratios.
  • Glare. A glossy label under a phone light can wash the bars out. Matt labels read better.

Common questions

Can I make a barcode for my product with this?

You can make the image, but a number for sale through shops has to come from GS1. For your own stock control or a market stall, any scheme works: use Code 128 with your own SKU, or an EAN-13 starting 20 to 29 for in-house labels.

What does the generator do with a wrong check digit?

It refuses to draw the bars and tells you the right digit, so a typo does not get printed.

Is a barcode generated here free to use commercially?

The image is yours: nothing is added to it and there is no watermark. The right to use a particular EAN or UPC number is a separate matter, and sits with whoever the number was issued to.

Do my numbers leave my device?

No. The bars are drawn in the page and the PNG and SVG files are created locally. Beyond a page-view count, nothing is sent.

Sources

Last reviewed November 9, 2026. Check digits are calculated here and tested against published GS1 sample numbers.