Code 128 Generator
High-density 1D barcode for full ASCII text; the default choice for shipping labels and asset tags.
How Code 128 is structured
Code 128 is a continuous, variable-length symbology: every data character is exactly 11 modules wide and built from three bars and three spaces, so the symbol grows with the text instead of jumping in fixed blocks. A message opens with a start character (A, B or C) and closes with a stop character 13 modules wide — the only element in the symbol that is wider than the rest. The encoder picks a subset per character and can switch mid-message, which is how one symbol can hold digits, mixed case and punctuation at the same time.
Code 128 check digit
The check character is mandatory and computed modulo 103. Take the value of the start character (103 for A, 104 for B, 105 for C), then add each following character's value multiplied by its position, counting the first data character as 1. Divide the total by 103; the remainder selects the check character. The reader strips it before returning data, so a wrong check character shows up as a symbol that simply refuses to scan.
Code 128 compared with Code 39
Next to Code 39, Code 128 prints the same text roughly half as wide and handles lowercase and control characters natively, where Code 39 needs escape pairs beyond its 43-character set. If the payload is a GS1 identifier rather than free text, the same bars are used by GS1-128 with FNC1 and application identifiers. Compare the Code 39 generator page for the same breakdown of structure, check digit and use cases.
Common Code 128 problems
The symbol is wider than the label
Auto mode keeps mixed-case text in subset B, one symbol character per input character. Reduce the module width before you shrink the height, move to a shorter payload, or switch a pure-digit string to Code 128 C, which halves its length.
Curly quotes and accented letters break generation
Code 128 as implemented here covers ASCII 0-127 only. Characters pasted from a word processor — em dashes, typographic quotes, é or ñ — fall outside that range and the encoder rejects the string. Replace them with plain ASCII equivalents before generating.
Nothing happens when the scanner hits the edges
The quiet zone is part of the symbol, not decoration: keep at least ten module widths of plain background on each side. Cropping that margin inside a bordered label is the most common reason a Code 128 that looks perfect fails to read.
Where Code 128 is used
- Carrier tracking numbers on parcel and pallet shipping labels
- Asset, tote and rack labels in warehouses where the payload is free text
- Serial numbers and batch codes on manufacturing documentation
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.