Code 128 is the most common 1D barcode in warehouses, asset tracking, and shipping label internals. It encodes any of the 128 printable ASCII characters and switches automatically between three internal modes (A, B, C) to pack data densely.
If you don't have a specific reason to use a different symbology — and you're not selling at retail — Code 128 is almost always the right choice.
Generated by JavaScript in your browser. Nothing is uploaded; nothing is stored on our servers.
At a glance
| Standard | ISO/IEC 15417 (2007) — ISO/IEC 15417 |
|---|---|
| Symbology family | Linear (1D), continuous, bidirectionally decodable |
| Character set | All 128 ASCII characters (0x00–0x7F) via three code sets (A/B/C) |
| Length | Variable; no formal upper bound (practical: ~25–30 chars in print) |
| Check digit | Modulo-103, calculated automatically; encoder adds, scanner validates |
| Module width (X) | Minimum 0.250 mm for general retail; 0.150 mm for high-resolution applications |
| Year introduced | 1981 (Computer Identics Corp.); ISO standardized 1999 |
“Code 128 is a high-density, linear symbology that encodes text, numbers, numerous functions, and the entire 128 ASCII character set (from ASCII 0 to ASCII 128).”
When to choose Code 128
Pick Code 128 when you need to encode mixed letters and digits, when you don't know the length up front, or when scanability at small print sizes matters. It is denser than Code 39 and almost as universally supported.
Almost every laser, CCD, and camera-based barcode scanner reads Code 128 by default. Mobile phone QR-and-barcode scanner apps also handle it.
Character set
Code 128 can encode all 128 ASCII characters from 0x00 to 0x7F, including lowercase letters, uppercase letters, digits, and punctuation. The encoder switches between Code Set A (uppercase + control), B (uppercase + lowercase + symbols), and C (pairs of digits, very dense) as needed.
For pure-digit data, the encoder uses Code Set C which fits two digits per symbol — making numeric Code 128 nearly as compact as ITF.
Check digit
Code 128 has a built-in modulo-103 check digit calculated automatically. You do not enter it yourself; the encoder adds and the scanner validates it.
If you see scan failures, the most common cause is print quality, not the check digit. Try a larger module size or higher print resolution.
Frequently asked questions
- What's the maximum length?
- There is no formal limit — Code 128 can encode any length string — but barcodes longer than about 25 characters become impractical to scan from print. For very long data, consider a 2D code like Data Matrix or PDF417.
- Does Code 128 support lowercase letters?
- Yes. The encoder uses Code Set B for strings with lowercase. Code 39 does not.
- Why is my Code 128 barcode wider than my Code 39 version?
- Despite being denser per-character, very short Code 128 strings can be slightly wider than short Code 39 because of the mode-switching overhead. The difference flips and Code 128 wins as the string grows past ~5 characters.