DEV Community

Cover image for 🏷️ Barcode Generator: CODE128 · CODE39 · EAN13 · EAN8 · UPC · ITF14 — as print-ready SVG
Tomaz
Tomaz

Posted on Originally published at tooladda.online

🏷️ Barcode Generator: CODE128 · CODE39 · EAN13 · EAN8 · UPC · ITF14 — as print-ready SVG

⚡ 10-second version

Type the number at tooladda.online/barcode-generator.html, pick the symbology, download an SVG. Vector means it prints crisply at any label size — which is the one property that decides whether a scanner reads it.

❗ Important

Your SKUs and product codes are commercial information. Nothing is uploaded here; encoding happens in your browser.


🧮 The EAN-13 check digit, worked out by hand

Retail barcodes carry a self-check. The 13th digit is computed from the first 12, so a mis-scan or a typo is caught rather than silently accepted. Here's the actual algorithm on a real code — 400638133393:

Digits:   4  0  0  6  3  8  1  3  3  3  9  3
Weights:  1  3  1  3  1  3  1  3  1  3  1  3
Products: 4  0  0 18  3 24  1  9  3  9  9  9

Sum = 89
Check digit = (10 − (89 mod 10)) mod 10 = (10 − 9) mod 10 = 1

Full EAN-13:  4006381333931
Enter fullscreen mode Exit fullscreen mode

Type the 12 digits and the tool appends the 1 for you. Type 13 digits with the wrong last one and you've printed a barcode that fails validation at the till — which is exactly the kind of error that only surfaces after 2,000 labels are on the shelf.

Choosing a symbology

Symbology Encodes Use it for Note
CODE128 Full ASCII, variable length 🏆 Internal SKUs, logistics, asset tags The general-purpose default
CODE39 A–Z, 0–9, few symbols Older industrial and automotive systems Lower density; widely supported
EAN-13 13 digits Retail products sold in shops Needs a real GS1-issued prefix
EAN-8 8 digits Small retail packs where 13 won't fit Also GS1
UPC-A 12 digits North American retail GS1 equivalent of EAN-13
ITF-14 14 digits Shipping cartons and cases Prints on corrugated board

⚠️ Warning

A generator can draw any EAN-13 you type — it cannot assign you one. Numbers for products sold through real retailers must come from GS1, the body that issues company prefixes. Invent a code and you risk colliding with someone else's product, and retailers will reject it. For internal stock, asset tags and warehouse use, make up whatever you like with CODE128.


🧭 How it works

Diagram


✨ What's inside

### 📐 Vector SVG output Bars stay geometrically exact at any size. A PNG barcode scaled up gets blurry bar edges, and blurry edges are precisely what a laser scanner cannot decode. ### ✅ Check digits computed Enter 12 digits, get a valid EAN-13. The tool also tells you when a code you pasted has the **wrong** check digit — before you print it.
### 🎛️ Size and bar-width control Adjust height, module width and whether the human-readable number prints below — the settings that decide scannability on your specific label stock. ### 🔒 Fully offline-capable No account, no upload, no per-barcode charge. Generate a thousand internal asset tags without anyone metering you.

🛠️ Real jobs

Situation Symbology
🏪 Retail product for shops EAN-13 or UPC-A, with a GS1 prefix
📦 Warehouse / internal SKU CODE128 — no registration needed
🖥️ Asset tags for IT equipment CODE128 with your own asset ID scheme
📚 Library or inventory system CODE39 or CODE128, whichever your scanner software expects
🚚 Shipping cartons ITF-14
🎟️ Event passes / vouchers CODE128 encoding a serial

📖 Four steps

1.  Open   →  tooladda.online/barcode-generator.html
2.  Choose →  symbology (CODE128 for internal, EAN-13 for retail)
3.  Enter  →  your code — check digit added automatically
4.  Export →  SVG for labels, then SCAN A TEST PRINT
Enter fullscreen mode Exit fullscreen mode

▶ Generate now — tooladda.online/barcode-generator.html

💡 Tip

Print one label and scan it with the actual scanner that will be used, before committing a roll. And never shrink a barcode horizontally to make it fit — squeezing the bar widths below the scanner's minimum module size is the single most common cause of "it won't scan". Reduce height instead; height is far more forgiving than width.


❓ FAQ

Is it free? Any limit?

Free, unlimited, no signup, no watermark.

Can I use a generated EAN-13 on a product in a shop?

Only if the number was issued to you by GS1. This tool encodes numbers; it doesn't allocate them. For internal use, CODE128 with your own scheme is unrestricted.

SVG or PNG?

SVG for anything printed — bar edges stay exact at any size. PNG only for on-screen use.

Why won't my printed barcode scan?

Usually printed too small or horizontally squeezed, insufficient quiet zone at both ends, low contrast, or a glossy laminate reflecting the scanner's beam.

Does it compute the check digit?

Yes — for EAN-8, EAN-13, UPC and ITF-14. It also flags a mismatch if you paste a full code with an incorrect final digit.

CODE128 or CODE39?

CODE128 unless a specific legacy system requires CODE39. CODE128 is denser and encodes the full ASCII set.

Is my product data uploaded?

No. Encoding is entirely local to your browser.


🔬 Under the hood

  • Barcode encoding in vanilla JavaScript, rendered as real SVG path geometry.
  • Check digit algorithms implemented per symbology, with validation on pasted codes.
  • Quiet zones included by default, because omitting them is the classic scanning failure.
  • Works offline once loaded.

Originally published on ToolAdda, where Barcode Generator runs free in your browser — nothing is uploaded, nothing leaves your device.

Top comments (0)