How Barcodes Work
A barcode is just a number (or text) printed as stripes — a font for lasers. The cleverness is in the details: how the stripes survive being scanned upside down, smudged and at an angle, and how a single “check digit” catches nearly every typo.
Bars are bits
A scanner sweeps light across the code and reads the reflectance pattern: dark bars and light gaps of varying widths encode digits or characters in a self-clocking pattern. Guard patterns at the ends tell the scanner where data starts and stops — and because the patterns are asymmetric, it can tell whether it's reading forward or backward and decode either way. The quiet zone — the mandatory white margin — is what lets the scanner find the code at all; cropping it is the #1 way people break printed barcodes.
The check digit: one digit against all typos
The last digit of an EAN-13 or UPC code is computed from the others. EAN-13's recipe: multiply alternating digits by 1 and 3, sum everything, and the check digit is what rounds the sum up to the next multiple of 10. For 590123412345, the weighted sum is 93, so the check digit is 7 → 5901234123457.
This catches every single-digit error and nearly all adjacent-digit swaps. When a cashier types a code by hand and the register rejects it instantly — that's the check digit doing its job. Generators compute it automatically, which is why you enter 12 digits for an EAN-13.
The formats that matter
- CODE128 — encodes full ASCII compactly; the general-purpose choice for logistics, tickets, inventory and asset tags.
- EAN-13 / UPC-A — the retail codes on product packaging; numeric only, fixed length, check-digit protected. UPC-A is essentially EAN-13 with a leading 0.
- CODE39 — older industrial format; uppercase + digits, no checksum required, verbose but extremely tolerant.
- ITF-14 — the thick-bordered carton code; wraps an EAN-13 for shipping boxes.
1D codes hold a dozen-odd characters; when you need URLs, Wi-Fi credentials or hundreds of bytes with error correction, that's a QR code's territory.
Do you need GS1?
The barcode image is free to generate. Retail EAN/UPC numbers, however, must be globally unique, and GS1 is the registry that assigns company prefixes — stores and marketplaces expect it. For everything internal (inventory, membership cards, lab samples, event tickets), any numbering scheme you control is fine, and CODE128 is usually the right container.
Printing rules of thumb
- Black on white, never low-contrast colors; matte beats glossy.
- Keep the quiet zone; don't crop tight.
- Scale proportionally — stretching one axis breaks the width ratios.
- Vector (SVG) for print; high-resolution PNG for documents.
Make one now
The barcode generator creates all five formats with live validation, automatic check digits and SVG/PNG downloads — free and entirely in your browser. Need to encode a URL or more data? Use the QR code generator.