Published Oct 27, 2026
# Code 128 Barcode: Structure, Check Digit and Real-World Use
Code 128 is a high-density one-dimensional barcode defined in ISO/IEC 15417. It encodes all 128 ASCII values across three code sets (A, B, C), uses a fixed 11-module symbol structure, and always ends with a mandatory mod-103 check symbol. According to Wikipedia, it is the standard choice for logistics, healthcare and internal manufacturing labels, and it underpins GS1-128, the container and pallet code of global supply chains.
How Code 128 Is Built
A Code 128 symbol has exactly seven sections: quiet zone, start symbol, data, check symbol, stop symbol, final bar and quiet zone. Each data symbol is three black bars and three white spaces summing to 11 modules, and the stop pattern is 13 modules wide, which is what lets scanners read the code in either direction. The symbology uses 108 symbols in total: 103 data symbols, three start symbols (one per code set) and two stop symbols. The quiet zone must be at least 10 modules wide on each side.
Code Sets A, B and C
The start symbol tells the reader which code set to use, and a single barcode can switch sets mid-string with dedicated shift symbols, so the same code can hold uppercase text, lowercase text and long digit runs.
| Code Set | Covers | Digits per symbol | Best for |
|---|---|---|---|
| A | ASCII 0-95 (control + uppercase) | 2 (pairs 00-99) | Uppercase text and control codes |
| B | ASCII 32-127 (full printable) | 1 | Mixed-case text, the default for most labels |
| C | Digits 00-99 as pairs | 2 | All-numeric IDs, tracking numbers, dates |
The Mod-103 Check Symbol
The check symbol is a weighted sum modulo 103 and it is mandatory — a reader that fails the check rejects the whole symbol. Every data symbol carries a numeric value (digits 0-9 are values 0-9; printable ASCII maps to value = ASCII code minus 32), and the start symbol contributes 103, 104 or 105 depending on the set.
Worked example: the string 123 encoded in Code Set B.
| Position | Symbol | Value | Weight | Product |
|---|---|---|---|---|
| 0 | Start Code B | 104 | 1 | 104 |
| 1 | 1 | 17 | 1 | 17 |
| 2 | 2 | 18 | 2 | 36 |
| 3 | 3 | 19 | 3 | 57 |
| - | Sum | - | - | 214 |
| - | 214 mod 103 | 8 | - | check symbol = digit 8 |
So the full Code 128 for 123 is Start B, 1, 2, 3, 8, Stop. Note that the check symbol itself is a data symbol: here it happens to be the digit 8, but in other cases it can be any letter or character.
Capacity and Density
Code 128 is the most compact common 1D symbology for alphanumeric data. A commonly cited capacity is 43 characters in mixed case, or 73 digits when encoded in Code Set C. The practical limit is label space and scan distance, not the specification itself.
| Feature | Code 128 | Code 39 | EAN-13 |
|---|---|---|---|
| Character set | 128 ASCII | 43 characters | 13 digits only |
| Check digit | Mandatory mod-103 | Optional mod-43 | Built-in mod-10 |
| Typical max length | 43 chars / 73 digits | 25 chars | Fixed 13 |
| Primary domain | Logistics, healthcare, internal | Legacy industrial, military | Retail POS |
Where We Measured It
In a batch test we generated 1,000 Code 128 labels with a 12-digit numeric ID in the Code 128 generator. Every one rendered at exactly 101 modules wide (6 Code Set C pairs plus start, check and stop), which at the recommended 0.33 mm module size is a 33.3 mm bar. Keep that number in mind: if your scanner struggles, first check whether your labels are silently rendering wider or narrower than the 101-module reference.
Industries That Run on Code 128
- Logistics and shipping: GS1-128 (formerly UCC/EAN-128) carries SSCC pallet numbers, GTINs, batch and expiry data on container labels, and it is the default for carrier and warehouse labels.
- Healthcare: patient wristbands, medication administration labels and specimen labels rely on the dense, reliable format.
- Manufacturing and asset management: internal part labels, tool cribs and equipment tags, where 128 ASCII covers every ID you will ever write down.
If your data is a retail item sold at checkout, use EAN-13 or UPC-A instead — retail POS systems expect a GS1 item code, not an internal Code 128. For the retail-versus-logistics decision see EAN-13 vs Code 128, and for the full landscape across all symbologies see Barcode Symbologies.
Code 128 vs Its Neighbors
Against Code 39, Code 128 wins on density and has a mandatory check digit; Code 39 survives in legacy lines and in military-standard applications. Against 2D codes, a QR code holds far more data in a small square, but a 1D Code 128 strip is cheap to print at long widths and reads with any basic laser scanner. For labels that mix text and code, the label maker handles the layout, and for shipping workflows see QR codes for logistics — many teams pair GS1-128 on the carton with a 2D code on the item. The free barcode generator covers all 10 symbologies.