Respect quiet zones
Leave blank space at least ten times the narrowest bar width on each side so scanners can find the start/stop patterns.
Generate Code 128 or EAN-13 barcodes locally and export them as PNG.
Linear barcodes pair narrow and wide bars to encode alphanumeric data. Different industries favor specific symbologies based on capacity, checksum rules, and licensing requirements.
| Symbology | Character set | Typical use | Notes |
|---|---|---|---|
| Code 128 | All ASCII characters | Logistics, shipping labels, inventory bins | High density and supports variable length data. |
| EAN-13 | 12 data digits + checksum | Retail product identifiers worldwide | Requires GS1-issued prefixes and correct checksum. |
| UPC-A | 11 data digits + checksum | North American retail | UPC-A is a subset of EAN-13; pad with leading zero if needed. |
| ITF-14 | 14 digits | Shipping cartons and outer packaging | Printed with bearer bars to protect against skewed scans. |
Clean barcodes reduce misreads and chargebacks. Follow these guidelines before shipping labels or mass-printing packaging.
Leave blank space at least ten times the narrowest bar width on each side so scanners can find the start/stop patterns.
Dark bars on a light matte background maximize readability. Avoid glossy varnishes that reflect laser scanners.
Print samples at actual size and scan with the same devices your warehouse or retail partners use to catch issues early.
Do you need specific DPI or label dimensions when exporting barcodes for printing?
import bwipjs from 'bwip-js';
async function renderBarcode(text, bcid = 'code128') {
const png = await bwipjs.toBuffer({
bcid,
text,
scale: 3,
includetext: true,
textyoffset: 8
});
return png;
}
renderBarcode('0123456789012', 'ean13').then(buffer => {
// save buffer to file system
});
import barcode
from barcode.writer import ImageWriter
def create_barcode(code: str, bcid: str = 'ean13', path: str = 'barcode.png') -> None:
generator = barcode.get_barcode_class(bcid)
ean = generator(code, writer=ImageWriter())
ean.save(path)
create_barcode('5901234123457')
The generator uses bwip-js to render Code 128, EAN-13, UPC-A, ITF, Code 39, Pharmacode, and many others. Checksums are calculated automatically when required.
Export high-resolution PNG or SVG assets, maintain the quiet zone when placing the code, and print with high contrast on matte stock.
No. All rendering occurs client-side, so product IDs or serial numbers stay on your device.
Yes. Change the scale, height, and toggle human-readable text to match your printer or label stock before downloading.
Scan the generated code with inventory scanners or mobile apps, confirm the checksum digit, and print a test label at the final size to ensure readability.