The Complete Guide to Barcode Generation: How It Works, Common Formats, and Batch Generation in Practice
From encoding principles to production: how barcodes work, a comparison of Code 128, EAN-13, UPC-A, QR Code and more, and how to generate and batch-export them.
What a barcode actually is
A barcode encodes a string of data (digits/letters) into a pattern of bars and spaces that an optical reader can decode fast. Key points:
- Encoding rules: each symbology has a fixed character set and start/stop characters (e.g., Code 128's Start/Stop).
- Check digit: some formats (EAN-13, UPC-A) append a check digit computed by a weighted algorithm to catch entry errors.
- Quiet zone: blank margins on both sides, typically 10× the module width, or the symbol won't scan.
Common formats compared
| Format | Type | Capacity | Typical use |
|---|---|---|---|
| Code 128 | 1D | variable, full ASCII | logistics, warehousing, internal traceability |
| EAN-13 | 1D | 13 digits | retail products |
| UPC-A | 1D | 12 digits | North-American retail |
| Code 39 | 1D | 43 chars | industrial, automotive |
| QR Code | 2D | up to ~7 KB | check-in, redirect, traceability |
| Data Matrix | 2D | high density | electronics, medical part marking |
| PDF417 | 2D | large text | IDs, logistics documents |
Selection guidance:
- Internal IDs / serial numbers → Code 128 (high density, full charset).
- Retail products sold outward → apply for EAN-13 / UPC-A from GS1.
- Mobile interaction (scan to redirect) → QR Code.
If you're not sure which symbology fits your use case, start with which barcode type to choose.
Generation: programmatic vs online
Programmatic (Node / Python): libraries like bwip-js (JS) or python-barcode (Python) let you embed generation in a pipeline and automate it. Downside: changing formats means changing code, and non-technical teammates can't use it.
Quick Python example with python-barcode:
import barcode
from barcode.writer import ImageWriter
# Generate a Code 128 barcode from a value
value = "A-01-01"
rv = barcode.get("code128", value, writer=ImageWriter())
rv.save("bin-label") # writes bin-label.png
Online generation: better for ops/warehouse self-service and for quickly validating a format. The online barcode generator on this site covers 35+ formats, with the highlights:
- Runs in the browser — no install, no login.
- Batch mode: upload a CSV or paste a text list and generate a whole batch in one click.
- Exports PNG / SVG; SVG drops straight into design files or print.
- Built-in scanner and label printing — generation to stickering in one place. See also batch Code 128 generation for a warehouse workflow.
Batch generation in practice
Take "batch-printing warehouse bin labels" as an example:
- Prepare data: a column of bin IDs (e.g.,
A-01-01…A-12-30) saved as CSV. - In the tool, pick Code 128 (use the Code 128 generator) and import the CSV.
- Set module width, height, and whether to show human-readable text.
- Batch-export PNG (for printing) or SVG (for vector archiving).
- Pair with label paper and use the barcode label print tool to output directly.
The whole flow takes minutes — far faster than handwriting or screenshotting one by one.
Production caveats
- Resolution: print at ≥300 DPI; PNG is fine for screens, prefer SVG for print.
- Compliance: barcode height and narrow-bar width must meet the standard — too small and it won't scan.
- Quiet zone: don't crop the side margins.
- Data validity: let the tool compute EAN-13 / UPC-A check digits; don't type them. Internal codes (Code 128) can be self-defined but keep them consistent across your system.
Summary
Barcode generation isn't complicated — the trick is "pick the right format + produce in bulk + output compliant." For most non-engineering scenarios, a good free online barcode generator covers ~80% of needs; on the engineering side, integrate a library into your system for automation. The two combined are the most efficient.
