Generate a barcode (SVG and PNG)

Pick a symbology, type the value and get a scannable barcode as a vector SVG for print and a PNG for screens. Check digits for EAN-13 and UPC-A are worked out for you, and an incorrect one is rejected rather than silently encoded. Everything runs in your browser.

✓ Runs in your browser — nothing uploaded Free, no sign-upNo watermark
2

Width of the narrowest bar. Bigger is easier to scan.

Downloads as .svg and .png

How to use the Barcode Generator

  1. Choose the symbology that matches where the code will be scanned.
  2. Type the value — for EAN-13 or UPC-A you can leave off the check digit.
  3. Adjust module width, height and quiet zone for your label size.
  4. Generate, then download the SVG for print or the PNG for screens.

Which symbology do you need?

SymbologyEncodesUsed for
EAN-1313 digitsRetail products, worldwide
UPC-A12 digitsRetail in the US and Canada
Code 128All 128 ASCII characters, any lengthShipping labels, cartons, internal SKUs, GS1-128
Code 390–9, A–Z, space and - . $ / + %Older industrial, defence and automotive systems

EAN-13 versus UPC-A

They are the same system. UPC-A is an EAN-13 with a leading zero, and every scanner sold this century reads both. EAN-13 is 12 information digits plus a modulo-10 check digit; UPC-A is 11 plus the check digit. The first two or three digits are the GS1 prefix, which identifies the GS1 member organisation that issued the company prefix — not the country of manufacture. Numbers for real retail must come from a GS1-licensed company prefix. A made-up number may scan perfectly and still collide with someone else’s product, and most retailers verify it against the GS1 registry before listing you.

The check digit

Take the digits from the right, multiply alternately by 3 and 1, add them up, and the check digit is whatever makes the total a multiple of ten. For 978030640615 that sum is 93, so the check digit is 7 and the full number is 9780306406157. This tool calculates it when you leave it off and refuses the code when you supply one that does not match — a transposed digit is otherwise invisible until a till rejects the item.

Code 128 and Code 39

Code 128 is the workhorse for anything that is not a retail product. It has three subsets: A for control characters and uppercase, B for the full upper and lower case set, and C which packs two digits into one symbol. The encoder switches between them automatically, so an even-length numeric value comes out roughly half as wide as the same value in mixed text. Code 39 is older and self-checking but about twice as wide per character and cannot encode lower case, so use it only when a legacy scanner or specification demands it.

Quiet zones, size and printing

The blank margin either side of the bars — the quiet zone — is part of the symbol, and removing it is the single most common cause of a code that will not scan. GS1 requires 11 modules on the left and 7 on the right of an EAN-13, 9 modules each side of a UPC-A, and at least 10 modules for Code 128 and Code 39. At nominal 100% magnification an EAN-13 is 37.29 × 25.93 mm including its quiet zones, and retailers accept 80% to 200% of that.

Print the SVG at 100% scale with any "fit to page" option switched off, on a matte white background. Keep strong contrast: black on white is safest, and red bars are effectively invisible to older red-laser scanners, which see red as white. Do not stretch a barcode horizontally on its own — scale both axes together, or the module widths stop matching the specification.

Frequently asked questions

Can I invent my own EAN-13 numbers?

For internal stock control, yes — many shops use the restricted prefixes 20–29 for in-store items. For anything sold through a retailer or listed on a marketplace you need a company prefix licensed from GS1, because the number has to be globally unique.

Why was my check digit rejected?

Because the last digit does not match the modulo-10 calculation for the digits before it. Enter just the first 12 digits (EAN-13) or 11 digits (UPC-A) and the correct check digit will be added automatically.

SVG or PNG?

SVG for anything printed: it is vector, so the bar edges stay perfectly sharp at any size and label software imports it directly. PNG is for screens, spreadsheets and quick pasting.

Does it do QR codes or GS1 DataMatrix?

QR codes have their own tool on this site. GS1 DataMatrix and PDF417 are not supported here — those are 2D symbologies with different rules about application identifiers.

Privacy

This tool runs entirely inside your browser using WebAssembly and the Canvas/File APIs. Your files are never uploaded to ToolFlint or any third party; you can verify this in your browser's network tab or by switching to airplane mode after the page loads. Read how we process files.

Last updated 2026-09-23.