Code 128 barcode generator
Type anything printable and get a scannable Code 128 symbol. This is the format to pick whenever the barcode is for your own system rather than a retail till.
Generate a Code 128 barcode
SVG shape mask (decorative)
Upload an SVG — the barcode is clipped to its shape. A horse SVG makes a horse-shaped barcode.
Code 128 is the general-purpose linear barcode. It covers the whole 128-character ASCII set — upper and lower case letters, digits, punctuation and the control characters — which is why almost every shipping label, warehouse bin card and asset tag you will ever print uses it. Unlike EAN or UPC, nobody allocates Code 128 numbers: you decide what the symbol says, and it means whatever your own system decides it means.
Its density comes from three interchangeable character sets. Subset A carries upper case and control characters, subset B upper and lower case and punctuation, and subset C packs two digits into a single symbol character. A good encoder switches between them part-way through a symbol, so a long run of digits ends up about half the width it would need in any other linear format. bwip-js, which draws the preview below, chooses the subsets for you.
The variant you meet in logistics is GS1-128, once called UCC/EAN-128: the same symbology with an FNC1 character in front and GS1 Application Identifiers structuring the payload, so a scanner can tell a batch number from an expiry date. If a carrier has sent you an SSCC label specification, GS1-128 is what they are asking for.
What Code 128 encodes
| Character set | All 128 ASCII characters, via subsets A, B and C |
|---|---|
| Length | Variable — no limit in the standard, bounded in practice by label width |
| Check character | Modulo 103, computed automatically, not shown in the human-readable line |
| Dimensions | Linear (1D) |
| Quiet zone | 10 × the narrow-bar width on each side |
| Standard | ISO/IEC 15417 |
Where Code 128 is actually used
Parcel and pallet labels
Carrier labels, SSCC serial shipping container codes and GS1-128 data blocks are all Code 128 underneath.
Warehouse and inventory
Bin locations, pick lists and stock movements — anywhere you own both the printer and the scanner.
Asset tags
IT hardware, tools and lab equipment, usually carrying an alphanumeric asset number.
Healthcare
Wristbands, specimen labels and medication trolleys, often as GS1-128 with an AI-structured payload.
Rules this Code 128 generator enforces
- Only printable ASCII survives a round trip through most scanners. Accented characters and anything outside ASCII will either be rejected or come back as mojibake.
- The check character is calculated for you — do not append one yourself.
- Spaces are legal but easy to lose when a value is retyped by hand; hyphens or underscores are safer separators.
- Long values make very wide symbols. Past roughly 20 characters, Data Matrix or PDF417 will fit the same data in far less space.
Printing a Code 128 symbol that scans
Code 128 is decoded by measuring the ratio between wide and narrow bars, so anything that thickens or thins the bars unevenly breaks it. Print black on white, export SVG when the label goes to a professional printer, and never stretch the symbol horizontally to make it fill a box in your layout.
Keep the quiet zone. Ten narrow-bar widths of blank space on each side is part of the symbology rather than decoration, and cropping it is the single most common reason a technically correct label refuses to read.
Code 128 questions
Do I need to register a Code 128 number with anyone?
No. Code 128 carries whatever text you put in it. Registration only applies to retail article numbers — EAN-13 and UPC-A — which are allocated by GS1.
What is the difference between Code 128 and GS1-128?
GS1-128 is Code 128 with rules on top: an FNC1 character at the start and GS1 Application Identifiers labelling each field. The bars are identical; only the agreed meaning of the data differs.
How long can a Code 128 barcode be?
The symbology sets no limit, but every character adds roughly 11 modules of width. A 30-character value on a standard thermal printer is already wider than a 100 mm label.