Barcode Generator (EAN / Code 128 / Code 39 / UPC)

Generate EAN-13, UPC-A, Code 39, and Code 128 barcodes as scalable SVG.

Free online barcode generator. Create EAN-13, UPC-A, Code 39, and Code 128 barcodes as crisp scalable SVG, with automatic check-digit calculation and verification. All encoding runs in your browser — no data is transmitted. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

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

EAN-13 is the 13-digit international retail barcode; UPC-A is the 12-digit North American version. UPC-A is actually EAN-13 with a leading zero, so this tool encodes them with the same underlying bars.

A barcode encodes a number or short string as a pattern of bars and spaces that a scanner can read. This generator builds the four most common 1D symbologies — EAN-13, UPC-A, Code 39, and Code 128 — straight from their official encoding tables and renders them as crisp, scalable SVG.

How it works

Each symbology has its own rules:

  • EAN-13 / UPC-A use three character sets (L, G, and R patterns of seven modules each). The first digit selects a parity pattern that interleaves L and G codes across the left half, and a modulo-10 weighted check digit guards against misreads. The tool computes that check digit and verifies any you supply.
  • Code 39 maps each of 43 characters (0-9, A-Z, and - . space $ / + %) to a fixed pattern of nine elements, framed by * start and stop characters with a narrow gap between symbols.
  • Code 128 set B encodes ASCII 32-126, prefixes a Start-B symbol, and appends a modulo-103 weighted check symbol before the stop pattern, giving a dense, reliable code.

The resulting bit pattern is drawn as black rectangles in an SVG with a proper quiet zone on each side and a human-readable caption underneath.

Choosing the right symbology

SymbologyDataTypical useNotes
EAN-1313 digitsRetail products globally12 digits + 1 check digit
UPC-A12 digitsNorth American retailEAN-13 with leading zero
Code 128ASCII 32–126Shipping, warehouse, internalCompact, high density
Code 39Digits, uppercase, symbolsIndustry, healthcare, DoDWidest scanner support

Pick EAN-13 or UPC-A when the item will go through any retail point-of-sale scanner — these are the formats checkout scanners worldwide expect. Use Code 128 for shipping labels and inventory systems where you need to encode letters and numbers in a compact space. Use Code 39 when compatibility with very old equipment is a priority; it is the only symbology here that does not require a check digit (though a check character can optionally be included).

Check digits and why they matter

Both EAN-13 and UPC-A include a mandatory check digit calculated from the other digits. The check digit lets the scanner detect single-digit errors and some transpositions instantly rather than silently misreading a code. If you supply all 12 significant EAN-13 digits, the tool computes and appends the correct 13th digit. If you supply all 13 and the last digit does not match, the tool flags the mismatch so you catch data-entry errors before printing.

Code 128 uses a weighted modulo-103 check character that is added automatically and is not shown in the human-readable text beneath the bars, because scanners handle it silently.

Tips for reliable scanning

  • For EAN-13, enter the 12 significant digits and let the tool append the 13th. For example 590123412345 becomes 5901234123457.
  • Keep the quiet zone — the blank margin on each side of the bars. The tool includes it in the SVG, but if you crop the image tightly or overlay text on the margin, scanners may fail to find the start/stop markers.
  • Use vector SVG when possible. Scaling a small PNG blurs the bars slightly and can cause scan failures. Export the SVG at the resolution your printer actually uses if you need a raster format.
  • Minimum print size matters for EAN-13 and UPC-A: the GS1 standard specifies a minimum width for reliable scan at typical retail distances. Printing a barcode too small is the most common cause of failed retail scans.
  • Everything is computed locally in your browser, so it is safe for internal SKUs, confidential product codes, and proprietary inventory numbers — nothing you enter leaves your device.