Code 128 Barcode Generator
Code 128 is the barcode to reach for when nobody has told you which barcode to use: serial numbers, asset tags, tickets, shelf labels, shipping references. It encodes any printable ASCII text, packs digits two to a symbol character, and every modern scanner reads it. Type below — the readout explains which of its three code sets your characters force.
Code 128 generator
Generated locally in your browser — nothing you type is transmitted or stored.
The three code sets, in plain terms
Code 128 is really three alphabets sharing one set of bars, and the encoder may switch between them mid-symbol:
- Code set A — uppercase letters, digits, punctuation, and the ASCII control characters (tab, carriage return…). Control characters are the only thing A has that B lacks, and they are what force a symbol into A.
- Code set B — uppercase, lowercase, digits, and punctuation. Any lowercase letter in your input forces set B, because A simply has no lowercase.
- Code set C — digits only, packed two per symbol character. This is the compression trick: a run of digits in set C takes half the width it would in A or B, which is why an encoder jumps to C for runs of four or more.
Worked at build time by this site's analyzer: the 13-digit input
4045678900012 gets the guidance “All digits with an odd count — mostly code set C, with one digit carried in code set A or B; adding a leading zero would make it fully paired.” — an odd digit count
leaves one digit unpaired, so adding a leading zero makes the symbol narrower. This guidance layer
is ours and is only advice; the actual code-set optimization inside the bars is performed by the
rendering library, which follows the same rules.
What this tool deliberately refuses
Control characters and accented text are rejected with an explanation, not encoded. Full Code
128 can carry both (sets A and FNC4 respectively), but FNC4 in particular is honored
inconsistently by real-world scanners — the same label can read as café on one device
and café on another. A generator that hands you that label without warning is not
doing you a favor. If you need non-ASCII text scanned reliably, use a QR code, which carries UTF-8
by design.
Quiet zones and sizing
Like every linear barcode, Code 128 needs light margins on both sides; the downloads include a margin of ten module widths on each side, and you should preserve it in your artwork. Width grows with content — around 11 modules per character plus fixed overhead — so long payloads make wide symbols. If a label keeps failing to scan, the first three suspects are trimmed quiet zones, too-small printing, and low contrast, in that order.
Code 128 FAQ
What characters can I encode?
This tool accepts printable ASCII: letters, digits, space, and punctuation (character codes 32–126). Full Code 128 can also carry ASCII control characters and, via the FNC4 convention, Latin-1 accented text — but FNC4 support is inconsistent across scanners, so this tool rejects those characters with an explanation rather than encoding something that reads differently on different devices.
Does Code 128 have a check digit?
Yes, but not one you type or see. Every Code 128 symbol ends with a mod-103 check character computed over the whole symbol; scanners verify it and it never appears in the human-readable text. The renderer computes it internally — your data is exactly the text you entered, nothing appended.
Why do people say digits are "cheaper" in Code 128?
Code set C encodes two digits per symbol character, so long digit runs take half the width they would as ordinary text. An even-length all-digit input is the most compact case; a good encoder switches to set C automatically for runs of four or more digits.
Code 128 or a QR code?
Code 128 for laser scanners, conveyor systems, and anywhere one line of text is scanned by hardware; QR codes for phone cameras and richer payloads. If your data is a URL for humans to scan, you want a QR code, not a Code 128.
Is anything I type sent anywhere?
No. Validation, guidance, encoding, and downloads all run locally in your browser.
Verify before production: test the downloaded barcode with your own scanner — this tool validates characters and structure, not your printer. Everything runs locally in your browser; see the methodology page.