Barcode Generator — Code-128 & EAN-13

Create Code-128 or EAN-13 barcodes. Private by design—everything runs locally in your browser.

Inputs & Options

Code-128 supports a wide range of characters. Choose EAN-13 for 12/13-digit retail codes.


Preview

About Code-128 & EAN-13

Code-128 is a compact, high-density symbology that supports the full ASCII set (via subsets A/B/C) and is widely used for logistics labels, inventory stickers, and internal IDs. EAN-13 is the most common retail barcode worldwide. It encodes 12 data digits plus a check digit

Best practices

  • Use SVG for print and high-resolution packaging; it stays sharp at any size.
  • Quiet zones: Keep a light margin (quiet zone) around the barcode.
  • Contrast: Dark bars on a light background work best.
  • Size: For EAN-13, typical minimum is ~37.29mm × 26.26mm.

Barcode Basics: Code-128 vs EAN-13 (and how to get print-ready results)

Barcodes turn numbers or text into machine-readable lines that scanners can decode instantly. This tool supports two of the most widely used symbologies: Code-128 and EAN-13. Everything runs locally in your browser, and you can export crisp SVG (best for print) or PNG (for quick digital use).

When to use each format

  • Code-128 — general-purpose, high-density barcode. Encodes a wide range of ASCII characters (via subsets A/B/C), making it popular for shipping labels, warehouse locations, and internal product IDs.
  • EAN-13 — 12 data digits plus a check digit. This is the retail standard in many regions. If you’re selling into stores or marketplaces, you’ll typically need official numbers issued via a standards body (e.g., GS1). Our generator can calculate the check digit from 12 digits or validate a full 13-digit code.

EAN-13 check digit (how it’s computed)

The final digit helps detect errors. The algorithm is simple:

  1. Add the digits in odd positions (1st, 3rd, 5th…).
  2. Add the digits in even positions and multiply that sum by 3.
  3. Add both results together; the check digit is (10 − (sum mod 10)) mod 10.

Enter 12 digits and this tool will fill the 13th automatically; enter 13 digits to verify an existing code.

Print & scan best practices

  • Prefer SVG for packaging and labels. Vector output stays sharp at any size. Use PNG only when you must rasterise, and export at high resolution (e.g., 300–600 DPI equivalent).
  • Keep a quiet zone: leave clear margins on all sides so scanners can detect the barcode edges. Increase the “Margin” option if devices struggle.
  • High contrast: dark bars on a light, non-gloss background scan best (e.g., black on white). Avoid low-contrast colours and busy backgrounds.
  • Size matters: very small bars can fail on lower-quality printers. If you print small, increase bar height and keep the text legible.
  • Data hygiene: EAN-13 accepts digits only; Code-128 accepts more characters. Avoid leading/trailing spaces and hidden characters.
  • Test in real conditions: print a sample, try multiple scanners/phones, and check from different angles and lighting. For thermal printers, disable smoothing and use the native printer driver if possible.

Retail readiness & numbering

For retail/EAN-13 use, obtain valid product numbers (commonly via GS1 or your regional numbering authority). Using made-up numbers can cause conflicts in stores or marketplaces. Remember: the country digits in an EAN identify the number issuer, not necessarily where the product was made.

Common workflows

  • Inventory labels (Code-128): encode SKU or location IDs, export SVG, drop into your label template, and print to a thermal printer.
  • Retail packaging (EAN-13): enter your 12-digit item number, let the tool add the check digit, export SVG, and place it on artwork with adequate quiet zones.

Tip: keep a small test sheet of barcodes with varying margins and sizes. Scan them with your actual devices to lock in settings before a big print run.

5 Fun Facts about Barcodes

Digit pairs = turbo mode

Code-128’s subset C packs two digits per symbol, so a 30-digit string only needs 15 characters—leaner bars and faster scans.

Compact encoding

Red bars vanish to lasers

Retail scanners use red light, so red bars can “disappear”. That’s why the safest pick is dark bars on a pale background.

Color quirk

Quiet zones are the runway

Those blank margins are signal ramps. Trim them too small and scanners lose the start/stop patterns—boost the margin if reads feel finicky.

Scan reliability

Check digits catch typos

EAN-13’s final digit flags almost every single-digit error and most swaps. If your pasted code fails here, it likely has a sneaky typo.

Error detection

The first “beep” was gum

The world’s first supermarket barcode scan (1974) was a pack of Wrigley’s gum. Your SVG export is a direct descendant of that beep.

Barcode lore

Explore more tools