Calculating Dots for ZPL label layout

Why this conversion trips people up

ZPL doesn't think in millimetres or inches — every printable dimension (^PW for print width, ^LL for label length, font sizes, barcode module widths) is specified in dots, and a dot is a physical property of the printer head, not the label.

The same 70mm label prints as a different dot count depending on your printer's resolution.

Printer DPI Dots per mm 70mm label width
203 DPI (most common thermal printers) 7.99 ~559 dots
300 DPI 11.81 ~827 dots
600 DPI 23.62 ~1,653 dots

Labels have a width and height in mm e.g. 70mm wide x 30 mm high.

The printer has a resolution, typically 203dpi or 300 dpi.

There are 25.4 millimeters in one inch, DPI = dots per inch

To work out the "dots" for ZPL commands to set width, length and position of elements you can use the following:

70 mm ÷ 25.4 = 2.7559 inches (rounded to 4 decimal places)

2.7559 inches × 300 dpi = 826.77 dots

a 70mm wide label on 300dpi printer has 827 dots approximately.

In a ZPL label print, we typically set the label dimensions near to the top of the ZPL code.

For a 70mm wide label we would use

^PW827

That 827 figure is where the ^PW827 example comes from — it's specifically a 300 DPI printer, not 203.

This is the single most common source of "my label prints wrong size" bugs: someone copies a ZPL template built for a 300 DPI printer onto a 203 DPI device (or vice versa) without recalculating the dot values, and everything comes out either too small (crops content) or too large (overflows onto the next label).

Step-by-step: converting your own label dimensions

  • Find your printer's actual DPI — check the label/spec sheet, or run a printer self-test (usually a button-hold combo on power-up) which prints diagnostic info including resolution.
  • Convert your label's width and length from mm to inches: mm ÷ 25.4.
  • Multiply by your printer's DPI to get dots: inches × DPI.
  • Round to the nearest whole dot (ZPL doesn't accept fractional dots) — round down if you need a small safety margin from the physical label edge.
  • Set ^PW<width in dots> for print width and ^LL<length in dots> for label length in your ZPL template.

Common problems

  • Barcodes look distorted or won't scan. Barcode module widths in ZPL (e.g. ^BY for Code 128) are also specified in dots — if you've hardcoded a module width tuned for 203 DPI and moved to a 300 DPI printer, the bars will be too wide/narrow relative to the spec the barcode format expects. Recalculate module width the same way as label dimensions.
  • Content is cut off on one edge. This is almost always a ^PW/^LL value calculated for the wrong DPI, or a value that doesn't account for the printer's non-printable margin (most thermal printers have a small unprintable strip at the label edge — check your printer's datasheet for this).
  • Same ZPL file, different printer, different result. If you support multiple printer models/resolutions, don't hardcode dot values — calculate them at print time from a stored mm/inch dimension and the target printer's known DPI, so the same label definition works across hardware.