Skip to main content

ZPL how-to

Get ZPL out of ZebraDesigner

ZebraDesigner saves a label in its own file format, not as ZPL. The ZPL is what the ZDesigner printer driver writes when the label prints, so print it to a file instead of a printer, open the file in a text editor, and the ZPL is there. Then check it before you reuse it: fonts can arrive as pictures, and printer settings can ride along.

Where this comes from

Every statement about ZebraDesigner and its driver on this page is from Zebra's own documents, which we read on 2026-12-01. We have not run ZebraDesigner, which is Windows software, so we do not show a file it wrote. The page numbers are Zebra's.

Print the label to a file

  1. Choose a ZDesigner driver for a ZPL printer. Zebra's article says the driver writes CPCL, EPL or ZPL depending on the driver selected and the language in its name.
  2. Open the print pane: the Print button on the Home tab, or Ctrl+P (Professional guide, p. 115).
  3. Tick Print to file, which "redirects the printing to a file" (Professional guide, p. 116; Essentials guide, p. 107), then Print, and choose where to save the file and its name.
  4. Open the file in a text editor. Answers on Stack Overflow describe a .prn file with the ZPL in it, opened in Notepad.

The fact sheet lists Print to file among ZebraDesigner's features, and both the free Essentials and the paid Professional guides describe the checkbox. It also says the version 10 driver is the one to use for new labels, and version 5 for older labels in EPL or CPCL.

Or send the driver to a file port

The accepted Stack Overflow answer and Zebra's article give a second way, which works from any Windows program that prints through the driver, not only ZebraDesigner:

  1. Open the printer's Properties and its Ports tab, and note the port it uses now.
  2. Choose Add Port, then Local Port, then New Port, and enter a file name, such as Zebra's example C:\ZebraPrinterOutput.txt.
  3. Check that the new port is ticked, and print. The driver writes to the file instead of the printer.
  4. When you are done, select the original port again, or later prints keep going to the file.

Zebra's article notes that this always writes the same file name, so each print overwrites the last: rename the file before you print again.

ZebraDesigner for Developers

The developer edition has an option for this. Its Store dialog can Generate print file with variables: .prn files of the commands it would send, in ZPL, saved on your disk rather than in the printer. Its guide suggests them for analysing print streams and for working its stored templates into other software (p. 18). It limits a stored template's name to 16 characters, though ^XF recalls names of only up to eight (ZPL guide, p. 372). The guide we read is from 2019.

What to look for in the file

  • Lines before the first ^XA. The accepted answer warns of header information before the first ^XA that you may not need. A label runs from ^XA to ^XZ. Before you delete anything outside that, check what it is: a graphic the label recalls has to reach the printer first.
  • Text sent as a picture. Zebra's guide says Windows TrueType fonts are sent to the printer as graphics, a couple of kilobytes, where a printer font sends only the text, a couple of bytes (Professional guide, p. 120). One Stack Overflow answer shows what it found in its file: ^FT320,64^XG007.GRF,1,1^FS. ^XG prints a graphic stored on the printer (ZPL guide, p. 373), which ~DG downloads as hex (ZPL guide, p. 175). Text that is a picture cannot be changed by editing the file. Choose a printer font instead, marked with a printer icon in the font list (Professional guide, p. 71), and print to file again. The developer guide adds that TrueType and OpenType fonts print as graphics and cause errors with variables (p. 19).
  • Other objects as pictures. Each object has a printing setting: use the printer's own element if it has one, or always print as graphics; if the printer lacks the element, it is sent as a graphic (Professional guide, p. 79). A barcode whose human readable text you restyle is sent as a graphic too (Professional guide, p. 90). A barcode drawn as a picture is fixed in the file like the text above.
  • Printer settings. The print pane's Speed and Darkness come from the driver (Professional guide, p. 116). In ZPL, ^PR sets the print speed until it is sent again or the printer is turned off (ZPL guide, p. 326), ~SD sets the darkness (ZPL guide, p. 333), and ^MD changes it, which on G-Series printers lasts past a power cycle (ZPL guide, p. 301). If your file has them, decide whether every label your code sends should change the printer, or whether to set it once.
  • The values you typed. The file holds the label as it printed that one time, with its values written into it. Those are what you replace next.

Clean it into a template

Keep ^XA to ^XZ, with any ~DG graphic it still needs. Here is a cleaned label, written by us for this page: a box, an asset name, a rule, a Code 128 barcode and a service date.

zpl
^XA
^PW812
^LL406
^LH0,0
^FO20,15^GB772,375,4^FS
^CF0,48
^FO40,35^FDPump 7, line B^FS
^FO40,100^GB732,3,3^FS
^BY2^FO40,130^BCN,100,Y,N,N,A^FDAT-01042^FS
^CF0,30
^FO40,310^FDService due Mar 2027^FS
^XZ

Then fill it from data, one of two ways.

  • Your code writes the values in. Replace each ^FD value with the next label's data and send the result. A ^ or ~ in the data starts a command, so escape it as the special characters guide shows.
  • The printer keeps the layout. Store it once with ^DF (ZPL guide, p. 174), with ^FN where each value goes (ZPL guide, p. 200):
zpl
^XA
^DFE:ASSET.ZPL^FS
^PW812
^LL406
^LH0,0
^FO20,15^GB772,375,4^FS
^CF0,48
^FO40,35^FN1^FS
^FO40,100^GB732,3,3^FS
^BY2^FO40,130^BCN,100,Y,N,N,A^FN2^FS
^CF0,30
^FO40,310^FN3^FS
^XZ

Then send only the values, recalled with ^XF (ZPL guide, p. 372):

zpl
^XA
^XFE:ASSET.ZPL^FS
^FN1^FDPump 7, line B^FS
^FN2^FDAT-01042^FS
^FN3^FDService due Mar 2027^FS
^XZ

Recalled values are read like any other field data, so a ^ or ~ in one needs escaping here too: add ^FH to that field in the recall, as the templates guide shows. Keep the format's name to eight characters: ^DF takes 16, but ^XF recalls names of up to eight.

ZebraDesigner can do the storing itself: File, then Store, sends the label to the printer's memory, and later prints send only the values (Professional guide, pp. 27, 28; Essentials guide, p. 26). Zebra's article on it recalls the stored label with ^XF and ^FN, as above. The templates guide covers what prints when a field or the format is missing. To send the store file without other software, the driver's Send File setting sends a ZPL file straight to the printer, by Zebra's article.

What we could check

  • Labelary drew the cleaned label as 1 label with 30,165 black dots, and zxing-cpp read the barcode as AT-01042, its bars from x 40 to 263.
  • The store and recall, sent together, drew the same dots: 0 differed.
  • That is Labelary's drawing of our ZPL, not ZebraDesigner's output and not a printed label. Print one and scan it before you rely on a template.

What ZebraDesigner does well

  • You design the label by eye. By the fact sheet, the Essentials edition is free; Professional, with a paid one-time licence, adds database connections, joining fields, formulas and RFID wizards.
  • It uses the printer's own fonts and barcodes, supports Unicode, has a GS1-128 wizard, and version 3 opens version 2 labels.
  • Its store and recall mode keeps the label on the printer and sends a few bytes a label instead of a few kilobytes (Professional guide, p. 27).
  • If you are on version 2, as the Stack Overflow asker was: Zebra says ZebraDesigner 2.x has reached the end of its service life, and its licences can no longer be activated (article 000015930).

Or design the label from data

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 },
5 "data": {
6 "asset": "Pump 7, line B",
7 "code": "AT-01042",
8 "due": "Service due Mar 2027"
9 },
10 "templates": [
11 {
12 "type": "Box",
13 "coords": [20, 15],
14 "width": 772,
15 "height": 375,
16 "thickness": 4
17 },
18 {
19 "type": "Text",
20 "dataPath": "asset",
21 "coords": [40, 35],
22 "font": "0,48"
23 },
24 {
25 "type": "Line",
26 "coords": [40, 100],
27 "length": 732,
28 "direction": "h",
29 "thickness": 3
30 },
31 {
32 "type": "BarCode",
33 "dataPath": "code",
34 "coords": [40, 130],
35 "style": "code128",
36 "moduleWidth": 2,
37 "height": 100,
38 "hri": "below"
39 },
40 {
41 "type": "Text",
42 "dataPath": "due",
43 "coords": [40, 310],
44 "font": "0,30"
45 }
46 ]
47}

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

zpl
^XA^MCY^XZ
    ^XA
    ^SZ2
    ^MMT
    ^MNY
    ^LL406
    ^PW812
    ^LH0,0
^FO20,15^GB772,375,4^FS
^CF0,48^FO40,35^FDPump 7, line B^FS
^FO40,100^GB732,3,3^FS
^BY2,2,59^FO40,130^BCN,100,Y,N,N,A^FDAT-01042^FS
^CF0,30^FO40,310^FDService due Mar 2027^FS
^XZ

If a program makes your labels, the layout can live in its code instead of a design file. This zeepler request makes the cleaned label above from JSON, with no designer, driver or print to file. The values are data, so the next label is the same request with new values.

  • In Labelary it drew the same dots as the plain ZPL above (0 differed), and zxing-cpp read AT-01042.
  • What it cannot do: open a ZebraDesigner file, use TrueType fonts, print a picture, read a database or write RFID. Its elements are Text, BarCode, QRCode, Line and Box, in six label sizes, all at 203 dpi.

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

  • 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.
  • Preview ZPL without a printer: See a label before printing it with Labelary's viewer or API, what zeepler's playground shows, and what no preview can tell you.
  • 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.
  • Logos and images in ZPL (^GF, ~DG, ^XG): Print a logo with ^GF, turn a PNG into hex, keep it under the size limit, and store it once with ~DG to print with ^XG.
  • GS1-128 barcodes in ZPL, with the check digit: Print GS1-128 with ^BC and FNC1, work out the mod 10 check digit of a GTIN or SSCC, separate fields that vary in length, and what the printer adds itself.
  • 300 dpi printers, and the same ZPL on 203 and 300 dpi: Why a 203 dpi label prints smaller at 300 dpi, scaling it by 1.5 and what does not scale exactly, ^MU in millimetres, and reading the printer's resolution.
  • Comments in ZPL: ^FX: Write a comment with ^FX, why a caret inside one runs as a command, comments outside ^XA and ^XZ, and why // is not a comment.
  • Emulate a Zebra printer for testing: A stand-in printer on port 9100 in a few lines of Python or Node.js, pointing your send code at it, checking what it caught in Labelary, and what a stand-in cannot test.
  • Convert ZPL to PDF or PNG: Labelary's API turns ZPL into a PDF, one label to a page, or a PNG of one label: curl, Python and Node.js, its limits, and what it means to send it your labels.
  • Convert a PDF to ZPL: Draw each page of the PDF as dots at the printer's resolution and send them as ^GF: a Python script, sizing, grey, the ^GF size limit, and why the label prints as a picture.
  • Convert EPL to ZPL: Translate an EPL2 label to ZPL by hand: each common EPL command and its ZPL equivalent, one label translated line by line, what does not carry over, and switching a printer's language.
  • Convert HTML to ZPL: Two ways from an HTML label to ZPL: draw the page in a headless browser and send the dots as ^GF (a Node.js script), or write the label as ZPL fields, with which HTML and CSS ideas carry over and which do not.

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.