Published: · Updated:
ZPL (Zebra Programming Language) is the standard way of telling a thermal label printer "print this, here". You do not send an image file; you send text, and the printer does the drawing.
Every label starts with ^XA and ends with ^XZ.
Everything in between belongs to that label. The smallest meaningful label looks
like this:
^XA
^FO50,50^A0N,40,40^FDHello^FS
^XZOpen this label in the ZPL viewer →
Reading it piece by piece:
^FO50,50 — Field Origin: the top-left corner of the
field. The unit is dots, not millimetres; how large a dot is
depends on the printer's resolution.^A0N,40,40 — font and size. N is the orientation
(normal); R, I and B rotate by 90, 180 and
270 degrees.^FD — Field Data: the actual content to print.^FS — Field Separator: closes the field. Forget it and
the following commands are treated as a continuation of the same field, which
makes the label look nothing like you expected.Coordinates in ZPL are dots, and the physical size of a dot depends on the printer's density. The common values are 8 dpmm (203 dpi) and 12 dpmm (300 dpi). The same ZPL that looks right on an 8 dpmm printer comes out small on a 12 dpmm one, because the same number of dots covers fewer millimetres. This is the most common "it worked on my machine" problem in ZPL.
^PW sets the label width and ^LL its length. If you
set neither, the printer falls back to its own defaults and your output varies
from machine to machine.
^FS. The field never closes, so the
following commands write into it — you get a label with "half of it gone".^FO
coordinate exceeds ^PW/^LL, the content is silently
clipped: the printer reports no error, it simply does not print it.You do not learn ZPL by reading the whole programming guide. Six commands cover the skeleton above; each has a reference page with syntax, an example and what our renderer does with it.
| Command | What it does | Reference |
|---|---|---|
^XA … ^XZ | Opens and closes one label | ^XA |
^FO | Field origin in dots from the top-left corner | ^FO |
^A | Font, orientation and size of the next field | ^A |
^FD / ^FS | The data of a field and its end | ^FD, ^FS |
^PW / ^LL | Label width and length in dots | ^PW, ^LL |
^BC | The Code 128 barcode most shipping and product labels use | ^BC |
From here the usual path is: keep the ZPL cheat sheet open while writing, look up anything else in the command reference, and when a file lands on your desk, read how to open a ZPL file and how to send ZPL to a network printer. The dot-versus-millimetre question above has its own walkthrough with measured numbers in dots, mm, inches and DPI migration. ZPL is Zebra's language; TSC printers speak TSPL and Zebra mobile printers CPCL — the ZPL hub lists the tools, the printers that run it and the comparisons with the other languages.
The hard part of ZPL is that seeing the result normally requires a physical
printer and a roll of labels: one attempt equals one label. Labelixa's preview
draws the ZPL at its real size in the browser and points out structural problems
— overflowing fields, a missing ^FS — with the line number. No
printer required.
The language is shared, but the output depends on the printer's dot density: positions are given in dots, so the same ZPL prints at different physical sizes on a 203 dpi and a 300 dpi printer.
No. An online viewer or a rendering API draws the label from the code, so you can read, write and fix ZPL before any printer is involved.
They open and close one label. Everything between them describes that label; commands outside the frame are ignored, which is one of the most common beginner mistakes.
A language. ZPL describes a label as commands the printer executes, so the same file can print at different physical sizes on different printers — a fixed format like PNG could not do that.
Six cover most labels: ^XA/^XZ to frame the label, ^FO for position, ^A for font and size, ^FD with ^FS for the data, ^PW/^LL for the label size and ^BC for a Code 128 barcode. Everything else is a variation on these.
A .zpl file opens in any text editor, because ZPL is plain text. What the file contains, how to read it, and how to see the label it describes.
Can ChatGPT or Claude Render ZPL?Language models write and explain ZPL but cannot see the printed label. How a render and validation tool closes that loop — browser, API or MCP — with prompts.
How to preview a ZPL file without a printerA ZPL file is just text — the label only exists once something draws it. Four ways to see and test a ZPL label without a printer, including CI.
Embed a ZPL Label Viewer in Your Own SiteShow rendered ZPL labels inside your own pages with one iframe — no server code, no libraries. How the embed works, the URL format, and its honest limits.