Barcode Generator (Code 128)
Code 128 barcodes from any text or number — the symbology on courier labels, warehouse bins and ticket stubs. Digit runs switch to the double-density subset automatically, the checksum is computed the way the spec demands, and the result downloads as sharp SVG or PNG.
How Code 128 actually encodes
Every symbol is eleven modules wide, split into three bars and three spaces of widths one to four. The reader measures ratios, not absolute sizes, which is why print sharpness matters more than print size. A message is: start symbol, data symbols, the mod-103 weighted checksum, and a thirteen-module stop pattern.
The three subsets share those patterns but map them differently: A for control characters, B for the printable ASCII this page uses, C for digit pairs. Switching between them mid-message is itself a symbol, so the encoder only switches when the run is long enough to profit — four digits at the end, six in the middle.
Frequently asked questions
Why Code 128 and not Code 39 or EAN?
Code 128 encodes the full printable ASCII set at the highest density of the one-dimensional symbologies, which is why logistics standardised on it (GS1-128 is Code 128 with an application header). EAN-13 is for retail product numbers only — thirteen digits, no letters — and Code 39 takes roughly twice the width for the same content.
What does the checksum protect against?
Misreads. The last symbol before the stop pattern is the weighted sum of every other symbol mod 103; a scanner recomputes it and silently rejects any scan where a bar was misjudged. It is why a crumpled label scans wrong never rather than wrong occasionally.
Why do long numbers make a shorter barcode than letters?
Subset C packs two digits into every symbol, so 12 digits cost 6 symbols instead of 12. The encoder here switches automatically when a digit run is long enough to pay for the switch — the same optimisation commercial label printers make.
SVG or PNG — which should I print?
SVG whenever your workflow allows: bars stay mathematically sharp at any size, and scanners read edge contrast. PNG at the offered resolution is fine for office printers. Whatever you choose, never let software scale a barcode non-uniformly — stretched bars change the ratios the scanner measures.
Related tools
- Image ConverterConvert PNG, JPG, WebP, AVIF, SVG, BMP and ICO in your browser — batch convert, rotate, flip, make favicons. Nothing is uploaded.
- Image Resizer & CompressorResize images to exact pixels or a percentage and compress them, with a live before-and-after size comparison.
- Video TrimmerCut a piece out of an MP4 without re-encoding it — the clip keeps the original quality and is ready in about a second. Nothing is uploaded.