Code 128 Barcode Generator
This free Code 128 barcode generator turns any printable text — product codes, serial numbers, asset tags, URLs or internal order IDs — into a crisp, scannable barcode right inside your browser.
How to use
- Type or paste the text you want to encode — printable ASCII characters — and the barcode preview updates as you type.
- Adjust the options if needed: module width scales every bar and space, bar height sets how tall the code renders.
- Click Download to save the SVG for print work or the PNG for screens; both files are generated on your device.
- Scan-test the downloaded image with a barcode scanner or phone app before printing labels at scale.
Frequently asked questions
Which characters can I encode?
All printable ASCII characters (codes 32–126): letters, digits, spaces and common symbols. Code 128 also defines sets for control characters and extended characters, but this tool intentionally supports the printable B/C sets only — input outside that range is rejected with a clear error instead of producing a broken code.
How does the automatic B/C switching work?
Code Set C packs two digits into one symbol, so runs of four or more consecutive digits are encoded in Set C; letters return to Set B. For odd-length digit runs, the first digit stays in Set B and the remaining even count uses Set C, which always leaves pairs inside Set C. Any valid composition scans identically — this tool simply documents its rule openly instead of hiding it.
What is the check character?
Code 128 ends every symbol sequence with a modulo-103 checksum: the start value plus each symbol value weighted by its position, reduced mod 103. It is computed and inserted automatically before the stop pattern, letting scanners detect misreads. You never enter it yourself.
Why is there blank space on both sides?
That is the quiet zone. The Code 128 specification requires at least 10 modules of blank space left and right so scanners can find where the pattern starts and ends. The generator includes this minimum quiet zone in the SVG and PNG automatically — keep it intact when placing the code in your layout.
Should I download SVG or PNG?
SVG is vector graphics: it scales to any size with perfectly sharp edges, which makes it the right choice for printing, laser engraving and label templates. PNG is a fixed-resolution bitmap rendered at three times the on-screen size, convenient for slides, documents and web pages.
Related tools
About this tool
This free Code 128 barcode generator turns any printable text — product codes, serial numbers, asset tags, URLs or internal order IDs — into a crisp, scannable barcode right inside your browser. Code 128 is the workhorse one-dimensional symbology behind shipping labels and inventory systems: it encodes all printable ASCII characters, stays compact, and is read by virtually every barcode scanner and phone app. The preview updates as you type, and you can download the result as an SVG for print or a PNG for screens. Two options control the geometry: module width sets how wide each bar element renders, and bar height sets the overall height. To keep codes short, the generator automatically compresses runs of four or more digits with Code Set C, which packs two digits into a single symbol, and switches back to Code Set B for letters — the rule this tool applies is documented in the FAQ below. Every barcode carries the standard modulo-103 check character, computed and placed automatically so scanners can verify each read. Nothing is uploaded: encoding happens locally on your device, with no accounts, no watermarks, no scan limits and no tracking.