ZPL how-to
Preview ZPL without a printer
To see a ZPL label without a printer, something has to draw it: Labelary's viewer or its API, or, for a zeepler request, our playground's templates. A preview draws what the ZPL asks for, not what your printer will do with it, so print one label before you rely on one.
Labelary's online viewer
Paste ZPL into Labelary's online viewer, choose the print density and the label size, and it draws the label. This page uses this sample:
^XA
^CF0,50
^FO40,40^FDRack 12, bay 3^FS
^BY2^FO40,110^BCN,100,Y,N,N^FDR12-B03^FS
^XZ- Choose your printer's density: 8 dpmm (dots per millimetre) for a 203 dpi printer, 12 dpmm for 300 dpi.
- The viewer does not draw the label in your browser. Its page sends the ZPL to Labelary's API, at
api.labelary.com, and shows the image that comes back. - Labelary's FAQ says its free API and online viewer come with no support, privacy or availability commitments, and its API page lists no zero data retention on the free plan. Preview labels with sample data, not real names or case numbers. Labelary also licenses an offline copy of its engine for use on your own machines.
Labelary's pages were read on 2026-11-21.
Labelary's API
The same drawing, from a script. Save the sample as label.zpl and send it:
curl --silent --data-binary @label.zpl --output label.png https://api.labelary.com/v1/printers/8dpmm/labels/4x2/0/- The answer is a PNG, 812 by 406 pixels for a 4 × 2 inch label at 8 dpmm: one pixel per dot.
8dpmmis the density,4x2the size in inches, and the last0which label to draw, counting from 0, when the ZPL holds several.- The free API needs no key and allows 3 requests a second and 5,000 a day, Labelary's API page says. Everything sent goes to Labelary, as with the viewer.
Add an X-Linter: On header and Labelary lists what it found wrong in an X-Warnings header:
curl --silent --data-binary @label.zpl --header "X-Linter: On" --dump-header - --output /dev/null https://api.labelary.com/v1/printers/8dpmm/labels/4x2/0/With ^FO40,250^GB300,1,4^FS added to the sample, a line 1 dot tall drawn 4 dots thick, it answered:
x-warnings: 98|1|^GB|2|Value 1 is less than minimum value 4; used 4 insteadA box cannot be shorter than its own line, so Labelary drew it 4 tall. The fields are where the problem starts (byte 98), how long it is, the command, which of its values, and the message.
zeepler's playground
The playground takes a zeepler request, the JSON you would send to the API, not ZPL.
- For each template it shows the ZPL and a picture of that label, drawn in advance from our own sample data.
- Signed in, Generate shows the ZPL for your own request, which counts as a label like any API call, or each field the API rejected, which is not billed.
- It draws no picture of your own label: zeepler does not send your labels to anyone else to draw. To see one, put the ZPL in a viewer, with sample data.
What a preview cannot show
- Your printer's density. A preview draws in dots, at the density you choose. At 12 dpmm the sample's ink covered the same dots as at 8, x 40 to 336, y 39 to 229, on a 1216 by 608 dot image. So on a 300 dpi printer the label prints at two-thirds of the size.
- Your label stock. The size you ask Labelary for decides what is drawn. Drawn as 3 × 1, the sample's barcode stopped at y 202, the image's last row. Label size and origin covers the size in dots.
- Fonts and graphics stored on the printer. Labelary has the printer's built-in fonts, not the ones you loaded. A field in
^A@N,50,50,E:MYFONT.TTFprinted in a different, wider font, at x 40 to 753, y 38 to 93 against x 43 to 336, y 39 to 85 in font 0, and its last character was not drawn. A^XGrecalling a stored graphic drew nothing. The linter warnedFile 'E:MYFONT.TTF' does not existandFile 'R:LOGO.GRF' does not exist. Labelary's own fonts N, J and L are not on a printer unless you load them, its FAQ says. - Settings an earlier label left. Labelary's FAQ says it simulates a new printer with factory settings. A real printer keeps
^CF,^FW,^POand others from one label to the next. The sample's text with no^CFprinted in font A, y 40 to 48; sent after^XA^CF0,80^XZ, it printed y 40 to 114. To preview that, send the earlier label in the same request. The font size, rotate and several labels guides cover which settings carry over. ^POIon your printer. Labelary turns the image about its middle. On a printer, where an upside-down field lands depends on the print width and label length, as the rotate guide explains.- Print quality. Zebra's reference says character size and how dark text prints depend on the printhead's density and the media. A preview shows neither, and a barcode that reads on screen may not scan once printed.
Print a test label
- Print one label on the printer and stock you will use, and measure it. At 203 dpi there are 8 dots to a millimetre, so the sample's barcode starts 5 mm from the left edge.
- Scan every barcode and QR code on the printed label.
- If other software prints to the same printer, print the test after it has run, so the test sees the settings it leaves.
~WCprints the printer's configuration label: its setup, its firmware version and what is stored on it. Zebra's reference says it works only when the printer is idle.
Previewing a zeepler label
Send this body to POST https://api.zeepler.com/v1/zeeplify with your API key in the x-api-key header. It is a working request, not an illustration: on every change, our tests run this same file through the API's code and compare the result with the ZPL below.
1{2 "config": {3 "size": "4x2",4 "resetPrinter": true5 },6 "data": {7 "item": "Rack 12, bay 3",8 "code": "R12-B03"9 },10 "templates": [11 {12 "type": "Text",13 "dataPath": "item",14 "coords": [40, 40],15 "font": "0,50"16 },17 {18 "type": "BarCode",19 "dataPath": "code",20 "coords": [40, 110],21 "height": 10022 }23 ]24}And the ZPL that comes back, ready to send to the printer:
^XA^MCY^XZ
^XA
^SZ2
^FWN,0^PON^PMN^LRN
^MMT
^MNY
^LL406
^PW812
^LH0,0
^CF0,50^FO40,40^FDRack 12, bay 3^FS
^BY2,2,59^FO40,110^BCN,100,N,N,N,A^FDR12-B03^FS
^XZThis request sets "resetPrinter": true, so the label starts with ^FWN,0^PON^PMN^LRN, and gives its Text a font, so an earlier ^CF cannot change it. That makes a preview closer to what prints on a shared printer.
- On its own, in Labelary, it printed at x 40 to 336, y 39 to 209.
- Sent after
^XA^FWR^POI^PMY^LRY^XZ, a label that sets four of those settings and prints nothing, it printed at the same place. - Without
resetPrinter, after the same label, the text printed turned and mirrored, across the barcode, and the ink covered x 40 to 263, y 69 to 362.
A preview of this ZPL sends its data to whoever draws it. Use sample values, as here, until the layout is right.
Sending it
- Call the API from your own server or integration engine, not from a web page. An API key in a browser is a key anyone can copy.
- A successful call answers
200with the ZPL as plain text. A request the API cannot turn into a label answers400with every problem listed by field, and is not billed. - Send the ZPL to a Zebra or other ZPL printer at 203 dpi. At 300 dpi the same label prints at two-thirds of the size.
The API reference has every field and status code.
Related guides
- QR code size in ZPL: How ^BQ magnification sets the size of a QR code, and how to work out the size in dots.
- Printing ^, ~ and _ in ZPL: Why a caret or tilde in your data cuts the field short, and how ^FH prints them.
- Font size in ZPL: Setting text height with ^A and ^CF, converting points to dots, and why ^CF carries over.
- Send ZPL to a Zebra printer from C#: Send ZPL from .NET to a network printer on port 9100, or to a USB printer through the Windows spooler, without the driver redrawing it.
- Code 128 barcodes in ZPL: Set a Code 128 barcode's width and height with ^BY and ^BC, work out its width in dots, and pick subsets A, B and C.
- Accented characters in ZPL (^CI28): Print é, ç, ô and € with ^CI28, switch the printer back with ^CI0, and what to do on older firmware.
- Send ZPL to a Zebra printer from Python: Send ZPL from Python to a network printer on port 9100, or to a USB printer through the Windows spooler, without the driver redrawing it.
- Change a barcode to a QR code in ZPL: Swap ^BC for ^BQ, start the field data with QA, so the first characters scan, and reset the ^BY left over from the barcode.
- Send ZPL to a Zebra printer from Node.js: Send ZPL from Node.js to a network printer on port 9100 or to a USB printer through a Windows printer share, and print from a web page through your server.
- Label size and origin in ZPL (^PW, ^LL, ^LH): Set the label size in dots with ^PW and ^LL, move 0,0 with ^LH, and stop the last label's settings moving this one.
- Templates in ZPL: store a format with ^DF, fill it with ^XF: Store a label layout on the printer with ^DF and ^FN, fill it with ^XF, and what prints when a field or the format is missing.
- Several labels in one ZPL job: Send several different labels in one job, stop each one inheriting the last one's font and barcode settings, and number a run with ^SN and ^PQ.
- EAN-13 and Code 93 barcodes in ZPL: Print EAN-13 with ^BE and Code 93 with ^BA, and the data each one changes: a replaced check digit, and characters Code 93 cannot hold.
- Print copies of a ZPL label with ^PQ: Print several copies of one label with ^PQ, why ^PQ after ^XZ prints only one, and each serial number twice with ^SN.
- Center text in ZPL with ^FB: Center text of any length with ^FB, why centered text sits a little left, and text too long for the block.
- Center or right-align a barcode in ZPL: Right-align a barcode with the third value of ^FO, center one by working out its width, and why ^FB does not move it.
- Wrap text and new lines in ZPL: Wrap long text with ^FB, start a new line with \&, and stop ^FB writing over its last line or cutting text off.
- Rotate text and barcodes in ZPL: Turn text and barcodes with N, R, I and B, where ^FO and ^FT put a turned field, ^FW and ^POI, and why both stay set.
- Boxes, lines, underline and bold in ZPL (^GB): Draw boxes and lines with ^GB, print white on black with ^FR, underline text with a line, and make text bolder.
Help with an integration
Email info@zeepler.com. You will get a reply within 2 business days. The support policy covers response times and version changes.