ZPL guide 2 of 9
Coordinates, dots and print density
ZPL places everything in printer dots. Learn how dots relate to millimeters and dpi, where position 0,0 is, how ^FO and ^FT differ, and how rotation and density change a layout.
Dots, millimeters and dpi
Question What is a dot, and how many dots per millimeter does my printer have?
Every position and size in ZPL is counted in dots, the smallest mark the printhead can make. How big a dot is depends on the printhead, so the same number of dots is a different physical length on different printers.
The guide lists printheads of 6, 8, 12 and 24 dots per millimeter. Think in dots per millimeter: it is how the guide describes the printheads, and the dpi figures it gives for the same head differ from page to page.pp. 210, 294
The guide is not consistent about dpi. For the 8 dots per millimeter head it says 200 dpi in its exercises, 203 in the ^GB entry, and 203.2 dots per inch in the ^LL formulas. For the 12 dots per millimeter head it says 300 dpi, 304 dots per inch in the ^JM entry, 304.8 in the ^LL formulas, and the ^LH entry lists 11.8 dots per millimeter.pp. 49, 210, 269, 293, 294
TipOur rule: use dots per millimeter for planning, and treat any dpi figure as nominal. Your printer's configuration label lists its resolution.p. 49
To convert a size in millimeters to dots, multiply by the dots per millimeter of your printer. A 100 mm wide label is 800 dots across at 8 dots per millimeter and 1200 dots at 12. The same method works for every width, height and thickness in the format.p. 210
Where 0,0 is, and how ^FO measures from it
Question Where is position 0,0, and what is the difference between ^FO and ^FT?
The default home position of a label is its upper-left corner, 0,0. Anything below and to the right of it can print.p. 293
The guide's exercise section words the home position differently, as the left-hand trailing edge of the label as it leaves the printer, with exceptions. The ^LH and ^FO entries are the authoritative description, so follow those.pp. 49, 201, 293
^FO places a field by its upper-left corner: x and y are dots from the label home, each 0 to 32000, default 0. Nothing checks that the result is on the label, so an oversized value can put the field completely off it.p. 201
^FT also positions relative to the label home, but it fixes the typesetting origin to the field's content rather than its upper-left corner. For barcodes the origin is the base of the code, and for boxes and images it is the bottom-left corner with left justification. If you leave x and y out, ^FT continues from the end of the previous text field.pp. 205, 206
WarningPrefer ^FO while you are learning. The guide lists several cases where ^FT without coordinates is not recommended, among them the first field in a format, variable data and fields after serialization.p. 206
With a text block, ^FO grows the block downward as the font gets larger, while ^FT anchors the last line and grows upward, which can push the text past the top of the label.p. 187
^LH moves the reference point itself, which is handy for preprinted labels. It affects only the fields after it, should be one of the first commands in the format, and stays in force until the printer is turned off or another ^LH arrives.p. 293
Both ^FO and ^FT accept a third justification value (left, right or automatic), but only on firmware V60.14.x, V50.14.x or later.pp. 201, 205
^XA ^LH24,16 ^FO0,0^A0N,30,30^FDHome^FS ^FO200,60^A0N,30,30^FDOffset^FS ^XZ
^LH moves the reference point 24 dots right and 16 down. The first field then starts at that new home, and the second 200 dots right of and 60 dots below it. The new home stays in force until the printer is turned off or another ^LH arrives, so start the next format with ^LH0,0 if it should count from the corner again.
Rotation and field direction
Question How do rotation and field direction change where text lands?
^A takes an orientation of N (normal), R (90 degrees clockwise), I (inverted 180) or B (read from the bottom up, 270). If you leave it out, the last ^FW value applies.pp. 60, 208
^FW sets that default for later fields; it starts at N at power-up and stays until the printer is turned off or a new ^FW arrives. A field with its own orientation keeps it.p. 208
^FO defines its x and y independently of rotation. Where the rotated text then sits also depends on the justification, so work out rotated layouts on a test label.pp. 201, 1606
^FP changes the direction of the field's characters: horizontal, vertical or reverse, with an optional extra gap between characters. It is mainly for Asian fonts.p. 202
The guide has a section of charts showing how rotation, ^FP direction and ^FO or ^FT justification combine for normal, rotated, bottom-up and inverted orientation. Refer to it when a rotated field lands somewhere unexpected.pp. 1606 to 1612
To turn the whole label around instead, ^PO with I inverts the format 180 degrees. It inverts the coordinates too, so a different ^LH can move the output back onto the label. The setting lasts until another ^PO or power-off.p. 322
^XA ^FWB ^FO50,50^A0N,30,30^FDNormal^FS ^FO100,200^A0,30,30^FDBottom up^FS ^XZ
After ^FWB the second field, which names no orientation, takes the bottom-up default. The first names N and ignores it. ^FW stays in force until the printer is turned off or another ^FW arrives, so start the next format with ^FWN if it should be back to normal.
Units, and moving a layout to another density
Question Can I use millimeters, and what happens at a different density?
^MU switches the unit of x, y and sizes to dots (D, the default), inches (I) or millimeters (M). It works field by field, carries over until you change it, and belongs at the start of the format.pp. 312, 313
^MU also converts a format between densities. The base value can be 150, 200 or 300 and the target 300 or 600; the guide's examples are 150 to 300, 150 to 600 and 200 to 600. Giving the same value twice turns conversion off.pp. 312, 313
^JM halves the density, for example 12 dots per millimeter becomes 6, and the guide says it doubles the format size and changes where ^FO places fields. It must come before the first ^FS and persists.p. 269
TipA layout written in dots for one head will not match another unless you plan the move: describe sizes in millimeters, or convert with ^MU, before trusting positions.p. 312
To nudge a finished format without editing fields, ^LT moves everything up or down by at most 120 dot rows on most printers, negative toward the top. A large negative value on some models can pull the media back out of the printer.p. 297
^XA ^MUm ^FO5,5^GB40,20,1^FS ^XZ
With millimeters selected, a box 40 mm wide and 20 mm tall with a 1 mm border starts 5 mm from the left and top. On an 8 dots per millimeter head that is 40 dots in, 320 dots wide and 160 tall. The unit carries over to later fields, so begin the next format with ^MUd if it counts in dots.
The same label with BarcoderX
Question How does BarcoderX deal with density?
BarcoderX is pre-launch and its API is not final. It is designed to let you describe a label once in .NET and emit ZPL or EPL. It snaps each module width to a whole number of printer dots and reports the effective size.
Questions
Is a 203 dpi printer the same as 8 dots per millimeter?
Nominally yes. The guide uses 200, 203 and 203.2 for that head in different places, which is why dots per millimeter is the safer unit.pp. 49, 210, 294
Where is position 0,0?
At the upper-left corner of the label, unless ^LH has moved the home position.p. 293
Can I use millimeters instead of dots?
Yes. ^MU with M switches coordinates and sizes to millimeters, and ^MU with I to inches.p. 312
Commands in this guide
- ^FOField OriginSets where the next field starts: the position of the field's upper-left corner, counted in dots from the label home position.
- ^FTField TypesetSets the field position, counted from the label home, using a typesetting origin that stays fixed to the field's contents and does not change with rotation.
- ^LHLabel HomeSets the label home position, the reference point that field positions are counted from. It affects only the fields that come after it.
- ^FWField OrientationSets the default rotation, and on newer firmware the default justification, for the fields that follow it.
- ^FPField ParameterSets the direction in which the characters of a text field are laid out (horizontal, vertical or right to left) and adds an optional gap between characters.
- ^AScalable/Bitmapped FontChooses the font, orientation, character height and width for the text field that follows. The choice applies to that one field only.
- ^MUSet Units of MeasurementChooses whether following values are read as dots, inches or millimeters, and can convert a format made for one density to another.
- ^JMSet Dots per MillimeterSelects between the printer's normal dot density and half of it. At the lower density the format is doubled in size, and field origins are affected.
- ^LTLabel TopMoves the whole label format up or down by a small number of dot rows, to fine-tune where it falls on the label without editing the fields.
- ^POPrint OrientationInverts the whole label format by 180 degrees, or sets it back to normal. Coordinates are then counted in the inverted frame.
- ^GBGraphic BoxDraws a box, or a line, with chosen width, height, border thickness, color and corner rounding.
- ^FDField DataDefines the data string of a field: the text or barcode data that the field carries.
- ^FSField SeparatorMarks the end of a field definition, so the commands that follow start a new field.
- ^XAStart FormatOpens a label format. A valid ZPL II format starts with ^XA and ends with ^XZ.
- ^XZEnd FormatCloses a label format. When the printer receives it, a label prints.
- ^LLLabel LengthSets the label length in dots. It is required for continuous media and can optionally be applied to gap and mark media as well.
Related guides
What is ZPL? The anatomy of a label Text and fonts in ZPL Boxes, lines, circles and ellipses Label size, quantity and printer settingsBarcoderX is a .NET SDK for thermal labels and barcodes. See how it prints and exports labels.
Source Zebra, ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide, P1134473-11EN Rev A, 2026/07/05, pages 49, 60, 187, 190, 201, 202, 204 to 206, 208, 210, 269, 293, 294, 297, 312, 313, 322, 1606 to 1612.
Written by BarcoderX in its own words. Checked against the guide on 2026-11-14.
ZPL and ZPL II are trademarks of Zebra Technologies Corporation. This reference is written by BarcoderX in its own words from Zebra's published programming guide. BarcoderX is an independent product and is not affiliated with, endorsed by or sponsored by Zebra Technologies.