What Code 128 is for
Code 128 is the general-purpose barcode for anything that is not a retail product number: stock-keeping units (SKUs) on your shelves, asset tags on equipment, library and file labels, order numbers on packing slips, and tracking numbers on shipping labels. It encodes letters, digits and punctuation, it is compact, and every barcode scanner reads it.
How it encodes
Each character is three bars and three spaces across 11 modules, between a start character, a mandatory check character and a stop character. Three character subsets cover capitals and control codes (A), capitals and lower case (B), and pairs of digits (C). The encoder chooses and switches subsets automatically, so "SKU-000123" uses subset B for the letters and can switch to C for long runs of digits, which encodes two digits per character and keeps numeric codes short.
Size and quiet zone
There is no fixed size. A module of 0.25 mm or more prints and scans reliably on office and thermal printers; go larger for scanning at a distance. The quiet zone must be at least 10 modules on each side, which the tool includes. Set the overall width and bar height; the size line shows the module width that results. Keep bars at least 10 mm tall, or 15% of the width, whichever is greater, for easy hand scanning.
Designing your codes
- Keep them short: every character adds 11 modules of width.
- Use a fixed length with leading zeros (SKU0001 to SKU9999) so they sort and look consistent. The label sheet maker can generate a zero-padded sequence.
- Avoid characters that are easily confused when read by people, such as O and 0, or I and 1.
- Do not use a shape that looks like a GTIN (13 digits) for internal codes, to avoid confusion with retail numbers.
For the differences between Code 128 and retail barcodes, see Code 128 vs EAN-13 for inventory.
Printing tips
- Print at 100%. In the print dialog choose "Actual size" or 100%, never "Fit to page". Scaling changes the bar widths, and a barcode printed at 94% can fall outside the reader's tolerance.
- Use vector files where you can. The SVG and PDF downloads are vector: bars stay sharp at any size and the PDF page is exactly the barcode's size. Use PNG for software that only takes images, at 300 dpi for office printers and 600 dpi for thermal label printers.
- Dark bars, light background. Black on white scans best. Dark blue and dark green work; red, orange and yellow bars are invisible to red-light laser scanners. The tool warns when the contrast is low.
- Keep the quiet zone. The clear margin either side of the bars is part of the symbol. Do not let text, a box edge or a label edge into it.
- Test before a print run. Print one, then scan it with the scanner your customers or staff will actually use, and with a phone app, before printing hundreds.
Why barcodes fail to scan
- Too small or scaled. Bars printed narrower than the reader can resolve, or a file squashed in one direction when it was placed in artwork.
- No quiet zone. Text, a border or the edge of the label too close to the first or last bar.
- Low contrast. Grey on grey, coloured bars on a coloured background, or bars printed on a shiny or transparent surface.
- Ink spread and blur. Inkjets on absorbent paper and worn thermal printheads widen the bars. Print a test and check the bars look crisp; for thermal printers, use 600 dpi or the printer's native resolution.
- Curved or creased surfaces. Bars wrapped around a narrow bottle or across a fold. Turn the barcode so the bars run with the curve (picket fence across a flat face, ladder around a cylinder).
- Wrong data. A check digit that does not match, or a number with the wrong length. This tool checks both before it draws anything.
Which download to use
- SVG for designers and packaging artwork. It is a vector file sized in millimetres, so it opens at the right size in Illustrator, Inkscape, Affinity and Canva, and stays sharp when printed. Do not stretch it in one direction.
- PDF when you send a file to a printer or place it in a print layout. The page is exactly the size of the barcode, quiet zone included, so it can be placed at 100% without measuring.
- PNG for software that only accepts images: label printer apps, spreadsheets, online stores and word processors. Choose 300 dpi for office printers and 600 dpi for thermal label printers. The tool rounds each module to a whole number of pixels so the bars stay crisp, which can make the PNG slightly smaller or larger than the millimetre size; the size line under the preview shows the result. Tick "transparent" to drop the background for placing on coloured artwork, but keep a light background behind the bars when printed.
To make many at once, use the ZIP option below the generator: paste one value per line or load a CSV and download PNG or SVG files named after each value.
How this tool works
Barcodes are drawn in your browser with bwip-js, an open-source (MIT) port of Barcode Writer in Pure PostScript, and PDFs are written with pdf-lib. Nothing you type is uploaded, and the page works offline after the first visit. Single barcodes are free in every format with no watermark. Paid licences cover print-ready label sheets and large batches; see the box above.