Barcode Tips: Print Code 128 Labels That Scan
The number one reason a Code 128 barcode won't scan is a missing quiet zone β the blank margin at each end β followed closely by printing too small and using low contrast. The encoding itself is rarely the problem; the failures happen at print time. This is a field guide to the settings and habits that make barcodes scan first time, every time.
The ByteTools Barcode Generator already computes the checksum and adds proper quiet zones for you, so most of the work is protecting those margins and choosing sensible dimensions before you print.
Protect the quiet zones
A scanner needs clear white space before the first bar and after the last one to know where the code begins and ends β at least 10 times the width of the narrowest bar. The generator bakes these margins into the PNG. The mistake is cropping them off in an image editor or placing the barcode flush against a box edge, a coloured band, or nearby text. Leave the downloaded margins intact and keep other artwork well clear of the bars.
Get the dimensions right
Bar width (the module width) and height both affect readability. Too thin and a laser scanner can't resolve the bars; too short and a hand scanner has to be aimed perfectly.
| Setting | Recommended | Why it matters |
|---|---|---|
| Narrowest bar width | ~0.33 mm (13 mil) or wider | Below this, cheap scanners misread; general-use labels want a comfortable margin. |
| Barcode height | 1β2 cm minimum | Taller bars tolerate a crooked scan angle. |
| Contrast | Pure black on white | Colour or grey backgrounds kill reflectivity contrast. |
| Data length | Keep IDs short | Long values make a wide barcode that may not fit the label. |
Common mistakes that break scanning
- Resizing non-proportionally. Stretching the PNG wider than tall (or vice versa) distorts the bar ratios. Always scale proportionally, and prefer setting size before download over resizing after.
- Printing on a low-DPI or inkjet-blurry printer. Bars blur together. Use at least 300 DPI and a laser printer for small codes.
- Coloured or glossy backgrounds. A red or metallic label reduces contrast; scanners read reflectivity, not just visual colour. Black bars on plain white is the gold standard.
- Trying to encode unsupported characters. Code 128 handles printable ASCII (codes 32β126) only. Accented letters and emoji can't be encoded β the tool flags them so you can fix the value first.
- Turning off the human-readable text. Keep the text label on so staff can key the value manually if a scan ever fails.
Test before you print a whole roll
Always scan one printed sample with the actual hardware and lighting you'll use in production before committing to a batch of labels. Check it at the distance and angle a worker will really use. Because the generator runs entirely in your browser, product codes and serial numbers never leave your device, so you can safely test with real internal data. If a sample fails, increase the bar width or height, confirm the margins are intact, and reprint β don't just try a different value.
Try the Barcode Generator β free and 100% in your browser.
FAQ
Why does my Code 128 barcode scan on screen but not on paper?
Almost always a print issue: the bars printed too small, the printer blurred them, or the quiet-zone margins were cropped. Increase the bar width and height, print at 300 DPI or higher on a laser printer, and keep the white margins the tool provides.
How wide should the narrowest bar be?
Aim for roughly 0.33 mm (about 13 mil) or wider for general-purpose labels. Thinner bars save space but demand a high-quality scanner and printer; when in doubt, go wider β it costs a little room but buys reliability.
Can I print barcodes on coloured labels?
Only if the bars stay pure black on a light, non-glossy background. Scanners read reflectivity contrast, so red, dark, or metallic labels often fail. Plain white stock with black bars is the safest choice.
Why does the tool warn about certain characters?
Code 128 encodes only printable ASCII (character codes 32β126). Accented letters, emoji, and other Unicode symbols have no encoding, so the generator flags them, letting you correct the value before you waste a label printing something unscannable.
Related free tools
- QR Code Generator β when you need a 2D code for phone cameras.
- UUID Generator β create unique IDs to encode.
- Random Number Generator β generate serial numbers.
- Password Generator β for secure asset or access codes.
Built by ByteVancer
ByteTools is a free product of ByteVancer, a software and web development studio building web apps, SaaS, and custom software. If you need inventory systems, label pipelines, or bespoke internal tools, explore what ByteVancer can build for your operation.
Recommended reading
XOR Cipher Use Cases: CTFs, Learning, and Puzzles
Real use cases for the XOR cipher, from CTF challenges and teaching bitwise logic to lightweight obfuscation, with concrete worked examples.
XOR Cipher Tips: Keys, Security, and Common Mistakes
Pro tips and common mistakes for the repeating-key XOR cipher: key length, reuse pitfalls, format choices, and when to switch to real encryption.
How to Use an XOR Cipher to Encode and Decode Text
A step-by-step guide to encoding and decoding text with a repeating-key XOR cipher, output as hex or Base64, privately in your browser.
When to Convert XML to JSON: Real Use Cases
Real-world use cases for an XML to JSON converter, from modernising legacy APIs to parsing RSS feeds and SOAP responses, with worked examples.