In-depth guide

How to Print Barcodes That Scan: Size, Quiet Zones, Color

How do I print a linear barcode so it scans reliably the first time?

Short answer

Size the barcode by its X-dimension (the narrowest bar), keep the full bar height and the blank quiet zones on both sides, and print dark bars on a light, non-red background. On a label printer, make each module a whole number of printer dots, export at final size instead of stretching an image, and test with more than one scanner before printing the batch.

On this page
  1. Start with the X-dimension
  2. Keep the full height and the quiet zones
  3. Use colors a red-light scanner can see
  4. Bar gain, bar width reduction and printer dots
  5. Worked example: UPC-A at 100% on a 203 dpi thermal printer
  6. Export the file without resampling it
  7. Placement: curved surfaces and print direction
  8. Test: "it scans" versus verification
  9. Pre-print checklist
  10. Next step

You have a valid number and a barcode image. Now it has to survive a printer, a label or package, and a scanner that may be years old. Most scanning failures come down to a few physical details: how wide the narrowest bar is, how much blank space surrounds the code, which colors you used, and how the printer turned the image into dots.

This guide covers linear (1D) barcodes: UPC-A, EAN-13, Code 128 and ITF-14. QR codes follow different sizing rules, which are covered in QR code size and error correction.

Start with the X-dimension

The X-dimension is the width of the narrowest bar or space in a barcode, called a module. Every other bar and space is a whole multiple of it, so X sets the size of the whole symbol. It must stay constant across the symbol, which is why stretching a barcode in only one direction breaks it.

For UPC and EAN, the GS1 General Specifications set the nominal X-dimension at 0.330 mm (0.0130 in.). The older term "magnification" describes size relative to that nominal, so 100% means X = 0.330 mm. At 100%, an EAN-13 is 37.29 mm (1.468 in.) wide including its quiet zones, with a bar height of 22.85 mm (0.900 in.). A UPC-A has the same 113-module width.

For products scanned at retail checkout, GS1 allows X from 0.264 mm to 0.660 mm, the familiar 80% to 200% range. GS1 also notes that a smaller X-dimension may lower scanning performance, so the minimum is a floor, not a target.

Other barcodes have their own ranges. Cartons scanned in warehouses use larger X-dimensions, and for internal Code 128 labels there is no GS1 rule: you pick a size your scanners read comfortably. Scanner manuals list reading ranges by X in mils (thousandths of an inch). Zebra's LS2208 reference guide, for example, lists a 100% UPC as a 13 mil symbol.

Size and quiet zone reference

BarcodeWhere it's scannedX-dimension min / target / maxMinimum bar heightQuiet zone left / right
UPC-ARetail checkout0.264 / 0.330 / 0.660 mm22.85 mm at target X (18.28 mm at min X)9X / 9X
EAN-13Retail checkout0.264 / 0.330 / 0.660 mm22.85 mm at target X (18.28 mm at min X)11X / 7X
UPC-ERetail checkout, small packs0.264 / 0.330 / 0.660 mm22.85 mm at target X9X / 7X
EAN-8Retail checkout, very small packs0.264 / 0.330 / 0.660 mm18.23 mm at target X7X / 7X
ITF-14Cartons in distribution0.495 / 0.495 / 1.016 mm31.75 mm10X / 10X, plus bearer bars
GS1-128Cartons and pallets0.495 / 0.495 / 1.016 mm31.75 mm10X / 10X
Code 128Internal labelsNo GS1 rule; match your scannersNo GS1 rule10X / 10X

Retail values come from GS1 symbol specification table 1 and carton values from table 2 (items scanned only in distribution). For SSCC pallet labels, GS1's table 5 caps the GS1-128 X-dimension at 0.940 mm. All bar heights exclude the human-readable digits.

Keep the full height and the quiet zones

Bar height

UPC and EAN symbols have a fixed relationship between width and height. GS1 US says that when you change one dimension you must change the other in proportion, and that you should print barcodes at full height rather than trimming bars to fit the package. Checkout scanners sweep the code at many angles, and a short symbol leaves fewer paths that cross every bar.

GS1's rule is that bar height must not be truncated below the minimum in the table, and that minimum is tied to X. A 150% symbol needs 150% of the nominal height. Cartons get a little slack: for GS1-128 and ITF-14 on items physically too small for 31.75 mm, GS1 allows 12.70 mm and, as a last resort, no less than 5.08 mm.

For internal Code 128 labels, a sensible floor is GS1's rule for small logistic units: the greater of 15% of the symbol's width (including quiet zones) or 12.70 mm (0.5 in.). Taller bars are easier to hit with a handheld scanner.

Quiet zones

A quiet zone is the blank margin on each side of the bars. The scanner uses it to find where the symbol starts and stops, so text, a border, a label edge or a second barcode inside it can stop a read. Quiet zones are counted in modules: 9X on each side of a UPC-A, 11X left and 7X right on an EAN-13, and 10X on each side of Code 128, GS1-128 and ITF-14.

Because quiet zones scale with X, a bigger barcode needs wider margins. Zebra also recommends at least 1/8 in. (3.2 mm) between a barcode and other printed areas or the label edge (Zebra). For ITF-14 printed without plates, such as on a thermal label, GS1 requires bearer bars at least twice the narrow bar width along the top and bottom of the bars; plate-printed corrugated boxes need a full frame.

Use colors a red-light scanner can see

Most checkout scanners, whether laser or imager, light the barcode with red light in the 630 to 680 nm range, and verifiers measure at 660 nm (GS1 2D Barcode Colour & Quality Guide). Under red light, a red surface reflects about as much light as white does. Red bars vanish, while a red background looks as bright as white paper.

So the rule is simple: bars must look dark under red light, and the background must look light. GS1 US names black, dark blue and dark green as good bar colors and says to avoid red and reddish tones such as brown for bars.

BarsBackgroundResult under a red-light scanner
Black, dark blue, dark greenWhite, yellow, orange, redWorks: dark on light
Red, orange, pink, reddish brownWhite or another light colorFails: bars look like background
Yellow or pastelWhiteFails: too little contrast
BlackDark blue, dark green, brownFails or marginal: background also looks dark
BlackMetallic foil or clear filmRisky: glare or show-through; print an opaque white patch first

Two more rules help. Print bars in one solid ink, not built up from four-color process dots, as GS1 US advises. And keep linear barcodes dark-on-light; GS1 notes they are printed that way for compatibility, so don't reverse them to light bars on a dark field.

The surface matters as much as the ink. GS1 notes that black on white paper easily reaches the top contrast grade, while brown corrugated board is dark enough that even dense black ink can only reach the lowest passing contrast grade. GS1 accordingly sets a lower minimum grade for ITF-14 printed directly on corrugated board at an X-dimension of 0.635 mm or more.

Phones can hide color problems. They read under white light and gather far more light than a checkout scanner, so a red barcode that scans on your phone can still fail at a register, according to the same GS1 guide.

Bar gain, bar width reduction and printer dots

Bar gain and bar width reduction

Printing rarely reproduces bars at their exact width. On a printing press, ink spreads and bars come out wider, which is called bar gain. In GS1's example, a 0.9 mm bar on the master image prints at 1.0 mm, a gain of 0.1 mm. The fix is bar width reduction (BWR): the printer measures the gain on a test run and the barcode file is made with bars narrowed by that amount. If you send artwork to a commercial printer, ask for their BWR value for your press and material instead of guessing.

Office printers have a similar problem. GS1 points out that a general-purpose printer's dot is noticeably larger than the pixel it represents, so bars print wider and spaces narrower unless the software compensates.

On thermal label printers, the main control is print darkness, which is heat. Zebra's barcode quality guide shows what too much darkness does: normal bars grow, and in rotated barcodes the bars and spaces run together. Too little leaves incomplete bars. Zebra advises using the lowest darkness and speed that still give complete, even bars. If you're still choosing hardware, see barcode label printers and labels.

Make each module a whole number of printer dots

A label printer can't print part of a dot. A "203 dpi" printer actually prints 8 dots per millimeter (203.2 dpi), so each dot is 0.125 mm wide. A 300 dpi printer prints 12 dots per millimeter, about 0.083 mm per dot. If X isn't a whole number of dots, each bar edge gets rounded to the nearest dot, and bars that should match come out unequal.

GS1's specifications list the UPC and EAN sizes that thermal printers can produce exactly:

PrinterDots per moduleX-dimensionUPC/EAN size
203 dpi (8 dots/mm)20.250 mm75.76%
203 dpi (8 dots/mm)30.375 mm113.64%
203 dpi (8 dots/mm)40.500 mm151.52%
300 dpi (12 dots/mm)30.250 mm75.76%
300 dpi (12 dots/mm)40.333 mm101.01%
300 dpi (12 dots/mm)50.417 mm126.26%
300 dpi (12 dots/mm)60.500 mm151.52%

Neither printer can make exactly 80%, and only the 300 dpi printer comes within about 1% of 100%. [VERIFY] GS1 accepts 75 to 80% symbols from on-demand printers only, and only if the area set aside for the symbol and its quiet zones is at least the footprint of an 80% symbol and the bars are not truncated. Larger in-spec symbols always scan more easily, so most people should take the next size up.

Worked example: UPC-A at 100% on a 203 dpi thermal printer

Say your label software is set to print a UPC-A at 100% on a 203 dpi thermal printer. Here is the dot math.

  1. Find the dot size. A 203 dpi printer prints 8 dots per mm, so one dot is 25.4 ÷ 203.2 = 0.125 mm.
  2. Divide the target X by the dot size: 0.330 mm ÷ 0.125 mm = 2.64 dots per module. The printer can't do that.
  3. See what happens if the software scales anyway. Each bar edge snaps to the nearest dot, so individual bars and spaces can be off by as much as one dot (0.125 mm), more than a third of a module, and the error changes from bar to bar.
  4. Pick a whole number of dots. Two dots (0.250 mm, 75.76%) falls below GS1's normal 80% minimum. Three dots gives X = 0.375 mm, or 113.64%, comfortably inside the 80 to 200% range. Use 3.
  5. Work out the width. A UPC-A has 95 modules: 95 × 3 = 285 dots = 35.625 mm (1.40 in.). Each 9X quiet zone is 27 dots, or 3.375 mm (0.133 in.). The total is 339 dots, or 42.375 mm (1.67 in.).
  6. Work out the height. Minimum bar height scales with X: 22.85 mm × (0.375 ÷ 0.330) = 25.97 mm, which rounds up to 208 dots (26.0 mm, 1.02 in.). The guard bars extend 5X further down, another 15 dots (1.875 mm), for 223 dots (27.9 mm, 1.10 in.) before the digits.
  7. Check the label. Side to side, the 3.375 mm quiet zones already exceed Zebra's suggested 1/8 in. clearance, and the 1.67 in. total fits a 2 in. wide label. Top to bottom, 27.9 mm plus 3.2 mm of clearance above and below comes to at least 34.3 mm (1.35 in.) before counting the digits, so a 1.25 in. tall label is too short.

If you need a symbol at or near 100%, run the same arithmetic on a 300 dpi printer: 0.330 ÷ 0.0833 = 3.96, so 4 dots per module gives X = 0.333 mm, about 101% and as close to nominal as that printer gets. The width with quiet zones is 113 × 4 = 452 dots, about 37.7 mm.

Export the file without resampling it

GS1 US warns against shrinking or enlarging existing barcode artwork; re-create the barcode at the size you need instead. Resizing a bitmap blends pixels into gray edges and uneven bars.

  • SVG (vector): edges are defined as shapes, so they stay sharp at any size, and the printer driver converts them to dots at its own resolution. Use SVG for package artwork and page layouts. Vector doesn't cancel the dot math, though. Placed at 100% on a 203 dpi printer, a vector UPC still asks for 2.64-dot modules, so set the size to a whole number of printer dots.
  • PNG (raster): a fixed grid of pixels. Export it at the printer's resolution with a whole number of pixels per module (3 pixels per module at 203 dpi in the example above), then print it at exactly 100%. Turn off "fit to page" and don't drag-resize it in a word processor.
  • JPEG: avoid it. Lossy compression adds blotchy artifacts around bar edges.

The Plain Barcode generator exports SVG and PNG and runs entirely in your browser. Whatever tool you use, set the final size before you export rather than scaling afterward.

Placement: curved surfaces and print direction

GS1 describes two orientations. In picket fence orientation the bars stand upright like fence posts; in ladder orientation they lie horizontal like rungs. On a flat surface, GS1 says either works equally well.

On a curved surface, a wide barcode in picket fence orientation can wrap around the curve until its ends are out of the scanner's view. GS1's rule is that the angle between the tangent at the center of the barcode and the tangent at its outer edge must stay under 30 degrees. If it doesn't, turn the barcode so the curve only shortens the bars instead of hiding them; on an upright can, that means ladder orientation. GS1's table makes this concrete: a 100% UPC-A or EAN-13 can stand picket fence on a container about 60 mm (2.36 in.) across, but at 45 mm (1.77 in.) or less it must be rotated to ladder.

Print direction matters too. GS1 notes that some processes give better bars when the bars run in the direction the material travels through the press. On thermal printers, Zebra's quality test shows that when darkness is too high, rotated barcodes have bars and spaces that run together, so recheck darkness if you rotate a barcode on a label.

Finally, keep the barcode off folds, seams, corners, flaps and embossing, which GS1 lists as things that can obstruct a symbol.

Test: "it scans" versus verification

"It scans on my phone" is a start, not a pass. Before a full run, test the printed label the way it will be used:

  • Scan it with at least two different devices, including the type of scanner your customer or warehouse uses. A phone forgives low contrast and red ink that a red-light checkout scanner won't.
  • Scan from a few distances and at a slight tilt. Zebra's LS2208 guide notes that aiming straight on can bounce light directly back into the scanner (specular reflection) and make decoding harder.
  • Compare the decoded digits with your number. A barcode that scans with the wrong number is worse than one that doesn't scan. The check digit calculator confirms the last digit.
  • Test under real conditions: the final material, after lamination, on the curved bottle, after a night in the freezer.

A scanner is designed to read imperfect barcodes; a verifier measures how imperfect they are. ISO/IEC 15416 defines how verifiers grade linear barcodes on parameters such as symbol contrast, edge contrast, modulation, defects and decodability, reporting an overall grade from 4.0 (A) down to 0 (F). GS1 requires at least 1.5 (C) for UPC and EAN, measured with a 6 mil aperture under 660 nm light, written 1.5/06/660. ISO/IEC 15415 is the matching standard for 2D codes. A browser-based generator can't produce a verification grade; that takes a calibrated verifier and the printed label.

Pre-print checklist

  1. Confirm the barcode type fits the job: UPC-A or EAN-13 for retail checkout, ITF-14 or GS1-128 for cartons, Code 128 for internal labels.
  2. Confirm the number and its check digit, and make sure the human-readable digits match the bars.
  3. Choose an X-dimension inside the range for that barcode. For retail UPC and EAN, that's 0.264 to 0.660 mm; aim for 0.330 mm or larger.
  4. On a label printer, make X a whole number of printer dots: 3 dots at 203 dpi or 4 dots at 300 dpi for retail UPC and EAN.
  5. Keep the full bar height for that X. Don't trim bars to fit.
  6. Keep the quiet zones clear (9X each side for UPC-A, 11X and 7X for EAN-13, 10X for Code 128 and ITF-14), plus about 1/8 in. from label edges and other print.
  7. Print dark bars (black, dark blue or dark green) on a light background (white, yellow, orange or red) in one solid ink. Add an opaque white patch under barcodes on clear or metallic material.
  8. Export at final size, as SVG or as PNG at the printer's resolution, and print at 100% scale.
  9. Orient the barcode for the surface: ladder orientation on tight curves, and away from folds, seams and edges.
  10. Print one test label on the final material and scan it with at least two devices. When a trading partner asks for it, have the label verified to GS1's 1.5 (C) minimum.

Next step

Open the generator, create your barcode, and set its size so the X-dimension is a whole number of your printer's dots. Print one label, scan it with two different devices, and only then print the batch. If it still won't scan, work through the barcode not scanning checklist.

Sources

  1. GS1: GS1 General Specifications Standard (Release 26.0)
  2. GS1 US: Place Barcodes on Products
  3. GS1: GS1 2D Barcode Colour & Quality Guide (Release 1.0, Feb 2025)
  4. ISO: ISO/IEC 15416:2025 Automatic identification and data capture techniques — Bar code print quality test specification — Linear symbols
  5. Zebra Technologies: Evaluating Barcode Quality (ZT510 User Guide)
  6. Zebra Technologies: Printing Issues (ZT510 User Guide)
  7. Zebra Technologies: LS2208 Product Reference Guide

Written by Toma Tomov, editor of Plain Barcode.

How guides are researched and corrected: Editorial Policy. Spotted an error? Email [email protected].