Barcode tools · logistics and labels
Code 128 generator.
Encode printable ASCII text in a compact, high-density barcode. The browser library handles Code 128's internal symbol selection and check character.
Code 128 data
Barcode
When to choose Code 128
Code 128 can encode uppercase and lowercase letters, digits and punctuation in printable ASCII, so it is a good fit for shipping labels, inventory IDs and internal asset labels. It is not a GTIN and does not make a product globally identifiable by itself.
Worked example: “Hi” and “123456”
Code 128 ends every symbol with a check character calculated modulo 103. For the text Hi in code set B the start character has value 104. The value of each data character is its ASCII code minus 32: H is 72 − 32 = 40 and i is 105 − 32 = 73. Each value is weighted by its position (1, 2, ...) and added to the start value: 104 + 40×1 + 73×2 = 290. 290 divided by 103 leaves 84, so the check character has value 84. The symbol is then start, H, i, check and stop: four 11-module characters plus the 13-module stop pattern, 57 modules in all, with a quiet zone of at least 10 modules on each side.
Digits can be packed in code set C, which encodes two digits per character. For 123456 the start character is 105, the pairs 12, 34 and 56 have weights 1, 2 and 3: 105 + 12 + 68 + 168 = 353, and 353 mod 103 = 44. That symbol is 5 × 11 + 13 = 68 modules wide, against 101 modules if the same six digits were coded one per character in set B. The library used by this page chooses the code set automatically.
How Code 128 works
Each character is 11 modules wide, drawn as three bars and three spaces. Code set A covers upper-case letters, digits and control characters, set B covers upper and lower case letters, digits and punctuation, and set C covers digit pairs 00 to 99. The standard is ISO/IEC 15417. When Code 128 is used under GS1 rules with an FNC1 character first it becomes GS1-128; this page makes plain Code 128, so use the GS1-128 generator for application identifiers.
Sources and as-of date
As of 26 October 2026. Code 128 is defined in ISO/IEC 15417, which is paywalled and not linked here; the structure and check calculation above follow the public description in the GS1 General Specifications and were recomputed independently.
Print tip: keep a quiet zone, use strong contrast, and scan a physical proof at the final size.
Frequently asked questions
What is the difference between Code 128 and Code 39?
Code 128 encodes the full printable ASCII range and is denser, especially for digits in code set C. Code 39 is simpler, limited to 43 characters, and wider for the same data.
How is the Code 128 check character calculated?
Add the start character value to each data character value multiplied by its position, then take the remainder after dividing by 103. For “Hi” that is (104 + 40 + 146) mod 103 = 84.
Does Code 128 hold lower-case letters?
Yes. Code set B includes lower case, which Code 39 cannot encode without extended pairs.
Can I use this for a product barcode at the till?
No. Retail point-of-sale symbols are EAN-13 and UPC-A. Code 128 is for logistics, inventory and internal labels, and it does not create a GTIN.
Worked example: ABC123 and 12345678
Code 128 chooses between three code sets to keep the symbol short. Digits in runs of four or more switch to the denser Code Set C, which packs two digits into each symbol character.
| Input | Start set | Symbol characters | Width incl. stop |
|---|---|---|---|
| ABC123 | B (value 104) | start + 6 data + check (67) | 101 modules |
| 12345678 | C (value 105) | start + 4 digit pairs + check | 79 modules |
For ABC123 the check character is (104 + 33 + 2×34 + 3×35 + 4×17 + 5×18 + 6×19) mod 103 = 582 mod 103 = 67. Eight digits use less than four fifths of the width of the same eight characters in Code Set B.
Next steps: Code 39 generator, GS1-128 generator, barcode generator, or barcode reader.