Blog Formats & standards

Code 128: the shipping-label barcode that never fails

Why Code 128 dominates logistics labels, how its three character sets work, what the check digit protects, and when Code 39 is still the better choice.

Code 128 is the workhorse of shipping and inventory labels. It encodes the full ASCII range, packs tightly, and includes a mandatory check character — which is why a Code 128 label printed on a cheap thermal printer at 203 DPI still reads on the first pass.

What makes it different

  • Full ASCII, including lowercase letters, punctuation and control characters.
  • Three character sets (A, B, C) chosen automatically to pack data efficiently.
  • Compact — roughly 11 modules per character, about 30 % narrower than Code 39 for the same data.
  • Mandatory check character (mod 103), verified by every scanner.
  • Self-checking structure, so moderate print quality is tolerated.

The three character sets

Set Encodes Used for
A Uppercase, digits, control chars Legacy systems, control sequences
B Upper and lowercase, digits, punctuation General text
C Pairs of digits only Long numeric strings

Set C is the reason Code 128 is so good for serial numbers: 18 digits take 9 symbols instead of 18, halving the width. A generator should switch sets automatically — QRify does, so you just type the value.

The check character

Every Code 128 symbol ends with a mod-103 check character computed from the start character and the weighted value of each data character. Scanners reject a mismatch, which catches smudged or misread labels before they enter your system.

You do not calculate it by hand; the encoder does. But it explains why a Code 128 label with a single broken bar usually fails cleanly rather than decoding to wrong data — which is exactly what you want in logistics.

When to use it

  • Shipping labels and carrier routing codes
  • Serial numbers and asset tags
  • Internal inventory and shelf labels
  • Anywhere the payload mixes letters, digits and punctuation

When not to use it

  • Retail products: use EAN-13 or UPC-A — the POS expects a GTIN, not a Code 128.
  • Cartons: use ITF-14, whose thicker bars survive corrugated board.
  • Tiny labels on metal: use Data Matrix, which handles curved and etched surfaces better.
  • Simple numeric codes on legacy hardware: Code 39 is more forgiving of ancient scanners.

Printing rules

  • Height: at least 15 % of the symbol length, and never less than 6 mm for handheld scanners.
  • Quiet zone: 10 modules on each side.
  • X-dimension: 0.25–0.5 mm for most labels. Below 0.25 mm, thermal printers start merging bars.
  • Colour: black on white. Red bars are invisible to red laser scanners.
  • Orientation: horizontal. A vertical Code 128 makes handheld scanners work harder.

Code 128 vs Code 39

Code 128 Code 39
Character set Full ASCII 43 characters, uppercase only
Density ~11 modules/char ~16 modules/char
Check digit Mandatory Optional
Readability at low quality Very good Excellent
Legacy support Universal since the 1980s Universal since the 1970s

If your system is from the 1980s and you only need uppercase letters and digits, Code 39 will never surprise you. For anything new, Code 128 is smaller and carries more.

Frequently asked questions

What data can a Code 128 barcode hold?
Any ASCII character, including lowercase and punctuation, plus digit pairs compressed in set C. Practical label lengths are up to about 40 characters before the symbol becomes awkwardly wide.
Does Code 128 need a check digit?
Yes, a mandatory mod-103 check character is part of the symbol. You do not add it yourself — the encoder appends it and the scanner verifies it.
Is Code 128 the same as GS1-128?
No. GS1-128 is Code 128 with a specific data structure (application identifiers) used in logistics. The symbology is the same; the payload rules are different.
Why does my Code 128 barcode look different from another one with the same text?
Because the encoder chose different character sets. Set C packs digit pairs, so a numeric string produces fewer, wider bars than the same string encoded in set B.

A small, independent studio project built for people who need a code that actually scans. کنوین

Back to the blog