Skip to main content

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:

zpl
^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:

bash
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.
  • 8dpmm is the density, 4x2 the size in inches, and the last 0 which 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:

bash
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:

text
x-warnings: 98|1|^GB|2|Value 1 is less than minimum value 4; used 4 instead

A 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.TTF printed 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 ^XG recalling a stored graphic drew nothing. The linter warned File 'E:MYFONT.TTF' does not exist and File '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, ^PO and others from one label to the next. The sample's text with no ^CF printed 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.
  • ^POI on 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.
  • ~WC prints 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.

json
1{
2 "config": {
3 "size": "4x2",
4 "resetPrinter": true
5 },
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": 100
22 }
23 ]
24}

And the ZPL that comes back, ready to send to the printer:

zpl
^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
^XZ

This 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 200 with the ZPL as plain text. A request the API cannot turn into a label answers 400 with 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

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.