Skip to content
Free Tool Arena

Money & Business · Guide · Developer Utilities

How to choose between barcode formats

Linear vs 2D, UPC/EAN/Code 128/QR/Data Matrix, data capacity, retail compliance, check digits, print size, common mistakes.

Updated April 2026 · 6 min read

Barcodes look interchangeable — black bars on white, a scanner beep, a lookup — but they’re not. Code 128 carries arbitrary ASCII; EAN-13 is locked to 13 digits; QR codes hold kilobytes; Data Matrix survives damage. Picking the wrong format means failed scans, rejected shipments, or retail compliance violations. This guide covers the dominant linear and 2D formats, what each is actually for, data capacity, scanner compatibility, print-size minimums, check-digit rules, and the defaults that get you to a working label without surprises.

Advertisement

Linear vs 2D — the first decision

Linear (1D) barcodes encode data in bar widths along a single axis. Simple, legacy-compatible, work with cheap laser scanners. Limited capacity (typically 20-40 characters).

2D barcodes encode data in a matrix (grid of squares or dots). Much higher capacity — QR codes hold up to ~3 KB. Require camera-based or imaging scanners (universal in 2026 — every smartphone qualifies).

Rule of thumb: if you’re encoding a few digits and need retail-counter compatibility, go linear. If you’re encoding URLs, JSON payloads, or anything over 20 characters, go 2D.

The linear formats you’ll actually encounter

UPC-A: 12 digits. Dominant in North American retail. Required for product listings at most big-box retailers. First digit = product category; next 5 = manufacturer code; next 5 = product; last = check digit.

EAN-13: 13 digits. International retail standard. A superset of UPC-A — a UPC-A barcode is an EAN-13 with a leading zero. Use EAN-13 for European/Asian markets.

EAN-8: 8 digits. Compact version for very small products (lipstick, gum). Limited product-code space; rarely used for new allocations.

Code 128: encodes all 128 ASCII characters, variable length. The workhorse of shipping and logistics — FedEx, UPS, USPS all use it. Denser than Code 39 for the same data.

Code 39: uppercase letters, digits, and a few symbols. Older, less dense than Code 128, but still required in some government and automotive workflows (AIAG).

ITF-14 (Interleaved 2 of 5): 14 digits. Used on shipping cartons that contain retail units — the “ outer box” code.

The 2D formats — use when you need capacity

QR Code: the dominant 2D format. Up to 7089 digits or ~2953 bytes. Reads from any angle (position markers in 3 corners). Error correction up to 30% damage. Native camera support on every smartphone since ~2018. Default choice for anything consumer-facing.

Data Matrix: very compact (smallest 2D format at small sizes). Dominant in industrial marking, medical device traceability, and small electronics. Reads at tiny sizes — can print on a 2mm square.

PDF417: stacked linear format. Used on driver’s licenses, boarding passes, shipping labels where a rectangular aspect ratio fits better than a square.

Aztec Code: similar capacity to QR; used on transit tickets (especially European rail), airline boarding passes. Central bullseye is the position marker.

MaxiCode: UPS-specific format for package routing.

Data capacity at a glance

UPC/EAN: 8-13 digits only.

Code 39: ~40 uppercase-alphanumeric characters practical max.

Code 128: ~80 ASCII characters practical max.

Data Matrix: up to 2335 ASCII characters.

QR Code: up to 4296 alphanumeric or 2953 binary bytes.

PDF417: up to 1850 ASCII characters.

Retail compliance — not optional

Selling on Amazon: UPC or EAN required, must be purchased from GS1 (the official registry). Made-up codes get your listing suppressed.

Selling in retail stores: UPC-A (US) or EAN-13 (Europe). Retailers scan at checkout — the code must be in the global GS1 database.

Shipping: carriers define their own labels. FedEx/UPS use Code 128 for tracking numbers and MaxiCode for routing.

Pharma (US DSCSA): Data Matrix with GS1 application identifiers for product ID, lot, expiration, serial. Mandatory for prescription drug units.

Check digits — the silent protector

Most retail barcode formats include a check digit — the last digit, computed from the others using a modulo algorithm. A scanner that reads 11 of 12 UPC digits and computes a check that doesn’t match rejects the scan.

UPC-A / EAN-13: mod-10 weighted sum.

Code 128: mod-103 checksum.

QR and Data Matrix: use Reed-Solomon error correction, which goes further — they can recover from partially damaged codes, not just detect errors.

Don’t compute check digits by hand. Let the generator do it. Hand-calculated UPC codes are a common source of returned labels.

Print size and resolution

Barcodes have minimum module sizes (the width of the smallest bar or square). Print too small and the scanner can’t resolve individual elements.

UPC-A: nominal 100% size is 1.469" wide, 1.02" tall. Allowed range 80-200% of nominal. Below 80% and scanners struggle.

Code 128: minimum module typically 0.010" at 300 DPI print. Shrinks well on thermal printers.

QR Code: minimum recommended is 1cm × 1cm for phone scanning. Below that you need macro scanning.

Quiet zone: blank space around the barcode. Omitting it breaks scanning. Linear codes need 10× module width of quiet space on each end; QR codes need 4 modules of white around the matrix.

Color and contrast

Barcodes need high contrast between bars and background.

Black on white is the safe default.

Colored barcodes can work but risk scanner rejection. Red bars on white fail common laser scanners (the laser is red and red-on-white reads as white-on-white). Dark blue or black on white/cream is safest.

Inverted barcodes (white bars on black) work in 2D formats that support them but break most linear scanners.

Common mistakes

Generating your own UPC. Retailers check GS1 registry. A fabricated UPC gets your product delisted. Buy codes from GS1 or use a product-registration service.

Skipping the quiet zone. Bordering a barcode with text or decoration right against the bars breaks scans.

Using QR for data that isn’t scanned.A QR code that prints on a receipt nobody photographs is wasted ink. Match the format to the workflow.

Storing URLs in QR codes without tracking.If you need to change the destination later, point QR to a URL you control (with a redirect), not the final URL. Otherwise reprinting is your only option.

Small, low-error-correction QR on printed materials.Anything physical will get scuffed. Use medium or high error correction (15% or 25%) on print, even if it slightly increases size.

Run the numbers

Generate and test barcodes with the barcode generator. Pair with the QR code generator when you need 2D codes with URL or vCard payloads, and the UUID generator if you need unique IDs to encode inside the barcode payload.

Advertisement

Found this useful?Email