Barcode generator

Generate Code 128 or EAN-13 barcodes locally and export them as PNG.

Barcode symbologies at a glance

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.

Printing and scanning best practices

Clean barcodes reduce misreads and chargebacks. Follow these guidelines before shipping labels or mass-printing packaging.

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.

Use high contrast

Dark bars on a light matte background maximize readability. Avoid glossy varnishes that reflect laser scanners.

Test at scale

Print samples at actual size and scan with the same devices your warehouse or retail partners use to catch issues early.

Quick question

Do you need specific DPI or label dimensions when exporting barcodes for printing?

JavaScript (bwip-js)

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
});

Python (python-barcode)

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')

Barcode generator FAQ

Which barcode symbologies does the tool support?

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.

How do I keep printed barcodes scannable?

Export high-resolution PNG or SVG assets, maintain the quiet zone when placing the code, and print with high contrast on matte stock.

Does the generator upload my barcode data?

No. All rendering occurs client-side, so product IDs or serial numbers stay on your device.

Can I adjust barcode dimensions and text?

Yes. Change the scale, height, and toggle human-readable text to match your printer or label stock before downloading.

How can I validate the barcode before production?

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.