Barcodes Demystified
A barcode looks like decoration until a scanner rejects it. The difference between codes that scan and codes that fail is spec compliance and print discipline — this guide covers both.
Updated 2026-08-06 · ~7 min read
What a barcode actually encodes
Bars and spaces are widths, not marks: each symbology defines patterns of narrow and wide elements representing digits or characters, framed by start/stop patterns and guarded by quiet zones. Scanners read the width sequence, decode it against the symbology table, and validate the checksum. Nothing about the meaning of the number lives in the code itself — a barcode is a dumb carrier of an identifier whose significance is looked up in whatever system receives it. Understanding that separates barcode generation (rendering) from numbering authority (allocation).
EAN-13 versus UPC-A: the retail pair
Retail outside North America standardizes on EAN-13; inside it, UPC-A's twelve digits dominate. The formats are siblings — a UPC code is an EAN with a leading zero, and modern scanners treat them interchangeably. Both are digit-only with a computed check digit, sized for point-of-sale scanning at fixed distances. The selection rule is geography, not preference: sell through North American retail, use UPC-A; sell elsewhere or globally, use EAN-13. Mixing them up produces codes that technically scan but fail retailer data validation.
Code 128: the workhorse for everything else
Code 128 encodes the full ASCII set at high density, which is why internal logistics, inventory tags, shipping labels, and asset tracking standardize on it. Unlike the retail formats it carries letters and symbols, and its three code sets let it compress digit runs efficiently. The trade: denser patterns demand better print quality. For any identifier that is not a retail GTIN — internal SKUs, batch numbers, membership IDs — Code 128 is the default answer, and its checksum validation catches the transcription errors that plague manual code entry.
Check digits: the math that catches typos
EAN and UPC end with a check digit computed from the others: weight the digits alternately by one and three, sum, and take the complement to the next multiple of ten. Scanners recompute it instantly and reject mismatches, so a single misread bar produces a non-scan rather than a wrong lookup — an asymmetry worth appreciating, since silent wrong reads would corrupt inventory at scale. Generators compute the digit automatically, but knowing the formula explains why a twelve-digit entry becomes thirteen and why hand-typed codes fail validation.
Quiet zones: the margin requirement everyone skips
Every symbology mandates blank margin before the first bar and after the last — typically at least ten narrow-element widths. Scanners locate the code by finding these transitions; cramped quiet zones make detection unreliable, and they are the single most common cause of 'the code looks fine but will not scan'. Label layouts must budget the margins explicitly rather than hoping the design accommodates them. The discipline: quiet zones belong to the barcode, not to the surrounding artwork.
Print quality: the half of the problem generation cannot fix
A spec-perfect code fails from poor printing: ink bleed thickens bars, low contrast defeats optical readers, curved surfaces distort widths, and glossy stock creates glare. The practical standards: laser or thermal printing over inkjet for small labels, matte stock, dark-on-light with strong contrast, and flat placement. Size matters too — scaling a barcode below its minimum module width makes bars indistinguishable to the scanner. Testing means scanning the actual production output with the actual hardware, not previewing on screen.
The GTIN question: official numbers for retail
Retail channels require globally unique product numbers issued by the numbering authority — buying prefixes, assigning them to products, and registering them so retailer systems recognize the company. A generated barcode renders whatever number you give it; it cannot allocate official prefixes. The workflow order matters: obtain or confirm the assigned GTIN first, then generate the code from that exact number. Skipping allocation and inventing numbers produces codes that scan physically but fail every retail database check.
Label design integration: placement and orientation
Where the code sits determines scanning ergonomics: flat surfaces favor horizontal placement at comfortable scanner heights; vertical orientation suits shelf-edge scanning. Avoid printing across folds, on transparent film, or near other high-contrast graphics that mimic bar patterns. For multipack products, decide deliberately whether each unit and the case carry codes — logistics operations expect case-level codes distinct from unit codes, and reusing one identifier across packaging levels corrupts inventory tracking.
Internal versus public codes: two governance models
Codes used only inside your walls need no registration — invent a scheme, document it, generate freely. Codes that leave your organization (retail, shipping carriers, standards-based logistics) must follow external schemes and allocations. The governance failure is mixing the models: internal formats leaking into retail channels or unregistered numbers printed on customer-facing packaging. Keeping the boundary explicit — internal prefixes documented and reserved, public prefixes obtained officially — prevents the expensive re-labeling projects that follow confusion.
Testing workflow: verify before bulk printing
The sequence that prevents waste: generate, print a sample on the actual stock with the actual printer, scan with the actual target hardware, then release the batch. Each 'actual' matters — desktop preview proves nothing about production output. Keep one verified sample with each label design as the reference. When a batch later fails, comparing against the known-good sample localizes the regression (printer drift, stock change, file re-export) in minutes.
Local generation for sensitive product data
Pre-launch product numbers, internal scheme identifiers, and unreleased SKUs are competitive information worth keeping close. Local generation keeps those numbers in your browser — the code renders on-device and downloads as an image, with nothing transmitted. For launch-sensitive catalogs, that locality is the difference between a safe workflow and leaking product plans to whatever server a generator uses.
Symbology choice and the printing rules that break scans
The first barcode decision is symbology, and it is dictated by the scanner ecosystem, not by preference. Code 128 carries any ASCII text and is the logistics default; EAN-13 and UPC-A carry fixed-length numeric product codes and are what retail scanners expect; QR codes carry URLs and larger payloads for phone cameras. Generating a QR code for a warehouse shelf that a laser scanner must read, or a Code 128 for a marketing poster, is a deployment mismatch — the barcode is technically valid and practically useless. Ask what device scans it before choosing the type.
Print quality is where valid barcodes fail. Scanners need contrast: dark bars on a light background, never the inverse, and never low-contrast color pairs like red-on-black that some scanners read and others refuse. Quiet zones — the blank margins flanking the symbol — are part of the barcode specification, and cropping them in layout software is the most common reason a barcode that scans in preview fails on the shelf. Size matters proportionally: shrink a barcode below roughly 80% of its nominal size and bar widths drop under what budget scanners resolve.
Verify the way scanners will. A phone camera app reading your generated barcode proves the encoding; it does not prove the print. For anything produced in volume, test a physical printout at final size with the actual scanning hardware — thermal printers smear thin bars, inkjet spreads them, and glossy stock adds reflections that defeat cheap readers. One printed test per label design costs minutes and prevents a recall-grade failure.
Common mistakes with this tool
- Cropping quiet zones to fit a design.
- Inventing retail numbers instead of using allocated GTINs.
- Scanning only the screen preview instead of the printed sample.
- Using retail digit-only formats for identifiers containing letters.
Frequently asked questions
Which barcode format do retail products need?
EAN-13 outside North America, UPC-A within it — both from officially allocated GTINs.
What is a check digit?
A computed final digit that lets scanners reject misreads; the generator calculates it automatically.
Why will my printed barcode not scan?
Usually quiet zones, contrast, or module size — print on real stock and test with the target scanner.
Can barcodes hold letters?
Code 128 can; EAN and UPC are digits-only.
Is it safe for unreleased products?
Yes — generation is fully local; your numbers never transmit.
Which barcode type should I use?
For retail products: EAN-13 or UPC-A. For internal logistics and shipping: Code 128. For phones scanning URLs or tickets: QR codes. The scanning hardware decides, not aesthetics.
Why does my barcode scan on screen but not when printed?
Usually quiet zones cropped away, insufficient contrast, or bars too thin for the printer's resolution. Print at final size with clear margins and test with the actual scanner.