Code 128 B Generator
Code 128 subset B: upper and lower case letters plus digits — the most readable general-purpose subset.
How Code 128 B is structured
Subset B is opened by the start character with value 104 and covers the printable ASCII range 0x20 to 0x7E: upper and lower case letters, digits, space and every punctuation mark on a US keyboard. One symbol character per input character, 11 modules each, means the printed width tracks the text length one to one and the human-readable line matches the data exactly.
Code 128 B check digit
As everywhere in Code 128 the check character is modulo 103, seeded here by the start value 104. Add each data character's value times its position — first character is position 1 — and take the remainder after dividing by 103. The check character is transmitted as part of the symbol but not part of the returned string.
Code 128 B compared with Code 128
Compared with subset A, B adds lowercase and drops the control characters, which is what most text labels need. Compared with subset C, B handles any characters but halves the digit density: a 12-digit number takes 12 characters in B and 6 in C. Compare the Code 128 generator page for the same breakdown of structure, check digit and use cases.
Common Code 128 B problems
Trailing spaces change the scanned value
Space is a legitimate subset B character, so a space picked up from a spreadsheet cell or a copy-paste is encoded faithfully — and returned by the scanner. Trim the input before generating; the preview will not warn you.
Digit-heavy strings come out unnecessarily long
Staying in B for a long numeric key doubles the symbol width versus subset C. Either generate those payloads as Code 128 C or use an auto-mode encoder, which shifts to C for digit runs and back to B for the rest.
The label reads on one scanner and not another
Some readers ship with subsets B and C enabled but A disabled. That is normally harmless, but if the same labels move between sites, pin the subset deliberately rather than relying on auto-switching so every site reads the same characters.
Where Code 128 B is used
- Product descriptions and text labels that mix upper and lower case
- Library cards and membership numbers with a letter prefix
- Document and file references that must match the printed text exactly
Not sure this is the right symbology? The barcode format guide groups every supported 1D and 2D format by industry with its character set and limits.