Skip to main content

ZPL how-to

Convert EPL to ZPL

There is no general converter from EPL to ZPL: Zebra's EPL and ZPL programming guides describe none, and the accepted answer on Stack Overflow rebuilds the label in a design tool instead. Translate it by hand. Most EPL2 commands have a ZPL command that does the same job, and both languages measure in dots from the top-left corner.

Where this comes from

Each command below is from Zebra's EPL Programming Guide (14245L-003 Rev. A, 2013) and ZPL Programming Guide (P1134473-11EN Rev A, 2026), which we read on 2026-11-27. The page numbers are theirs. Where a guide does not settle a point, we say so.

  • The origin is the same. The EPL guide puts a field's origin at its upper left corner, on a grid in dots; ZPL's label home is the upper left corner, 0,0, and ^FO sets the upper left of a field.
  • So are the units: dots, 8 to the millimetre at 203 dpi in ZPL's reference, and the EPL guide writes 3 mm as 24 dots. The label size guide converts inches to dots.

EPL commands and their ZPL

  • N becomes ^XA. N clears the image buffer before a new label; ^XA starts a label. The EPL guide asks for a line feed before N, and for setup commands such as q and Q to come before it. (EPL p. 122; ZPL p. 370.)
  • q812 becomes ^PW812. The label width in dots. On EPL desktop printers, the EPL guide says, q also sets the left margin to (print head width - label width) / 2, which centres the label. ^PW's reference says nothing of the kind, so print one label and check the left edge. (EPL pp. 137, 138; ZPL p. 329.)
  • R becomes ^LH. R moves the reference point: every later x and y is measured from its left and top margins, in dots. It also makes the image buffer the full width of the print head, which overrides q and its centring. ^LHx,y moves 0,0 for every field after it, so an EPL R value goes straight into ^LH. (EPL pp. 138, 143; ZPL p. 293.)
  • Q406,24 becomes ^LL406 and ^MNY. Q is the label length and the gap between labels, in dots. ^LL is the length, and ^MN how the printer finds the next label: Y for a gap, M for a black mark (Q with B before the mark's thickness), N for continuous media (Q with a gap of 0). (EPL p. 139; ZPL pp. 294, 307.)
  • A40,30,0,4,2,2,N,"Rack 12, bay 3" becomes ^FO40,30^A0N,48^FDRack 12, bay 3^FS. Text: x and y, rotation, font, the width and height multipliers, N or R for reversed, then the data. ^FO is x and y, ^A the font, orientation and height, ^FD the data. EPL's rotations 1, 2 and 3 are 90, 180 and 270 degrees, and ^A's R, I and B are 90 degrees clockwise, 180 and 270. The EPL guide does not say which way its 90 turns, so check a turned field. R, white on black, is ^FR in the field. (EPL pp. 43, 44; ZPL pp. 60, 201, 203.)
  • B40,130,0,1,2,2,100,B,"R12-B03" becomes ^BY2^FO40,130^BCN,100,Y,N,N,A^FDR12-B03^FS. A barcode: x and y, rotation, type, narrow bar width, wide bar width, height, B (with its text) or N, then the data. Type 1 is Code 128 with the subsets chosen for you, ^BC's mode A. The narrow bar width is ^BY's module width, and B is ^BC's Y. Code 128 has no wide bar: the EPL guide's table marks its wide bar N, and ^BC has a fixed ratio. For a barcode with wide bars, such as Code 39 (type 3), the wide bar width is in dots and ^BY's ratio is wide over narrow, 2.0 to 3.0: B..,3,2,6 is ^BY2,3.0. At small module widths the printer rounds the ratio, to 2:1 or 2.5:1 for most ratios at 2 dots, so not every EPL pair has a match. (EPL pp. 52, 53; ZPL pp. 94, 148.)
  • LO40,100,732,3 becomes ^FO40,100^GB732,3,3^FS. A black line: x, y, the length across and the length down. ^GB is a width, a height and a thickness; a line is a box as thick as its shorter side. (EPL p. 118; ZPL p. 210.)
  • LW becomes ^GB with colour W. A white line over what is already there: ^GB's fourth value, W. (EPL p. 120; ZPL p. 210.)
  • LE becomes ^FR in a ^GB field. A line that reverses what is under it. Zebra's ZPL reference says a field with ^FR prints the reverse of its background. We have not drawn ^FR on a ^GB. (EPL p. 117; ZPL p. 203.)
  • LS becomes ^GD. A diagonal line. ^GD draws one across a box of the width and height you give it. (EPL p. 119; ZPL p. 213.)
  • X20,15,4,792,390 becomes ^FO20,15^GB772,375,4^FS. A box: x and y, the line thickness, then x and y of the far corner. ^GB takes the width and height, so subtract: 792 less 20 is 772. The EPL guide does not say whether the far corner's dot is inside the box, so the ZPL may be a dot smaller. (EPL p. 168; ZPL p. 210.)
  • GW becomes ^GF. A picture: x and y, its width in bytes (8 dots to a byte), its height in rows, then the bytes. ^GF takes the same rows as binary (B) or hex (A), after the byte count, twice, and the bytes a row. (EPL p. 110; ZPL p. 215.)
  • P2 becomes ^PQ2, then ^XZ. P prints: the number of label sets, then copies of each, which the EPL guide ties to counters. ^PQ's first value is the total number of labels and ^XZ ends the label. So P5,2 is not ^PQ5: with counters, its second value is closest to ^PQ's third, replicates of each serial number, which the print copies guide covers with ^SN. (EPL p. 135; ZPL pp. 324, 375.)
  • S becomes ^PR. Print speed. S takes a value whose speed depends on the printer model: on a GK420, S4 is 4.0 inches a second. ^PR takes the speed in inches a second, so look the value up in the EPL guide's table for your model: S4 on a GK420 is ^PR4. (EPL p. 144; ZPL p. 326.)
  • D becomes ~SD or ^MD. Darkness. EPL's D is 0 to 15; ZPL's ~SD is 00 to 30, and ^MD adds to it. Neither guide maps one scale to the other, so we do not: set it on the printer and print one. (EPL p. 88; ZPL pp. 301, 333.)
  • I becomes ^CI. The character set. EPL's default is DOS code page 437; ^CI 0 to 12 are Zebra's code page 850 with some characters replaced, so there is no exact match for every EPL code page. For UTF-8 text, use ^CI28, as the accented characters guide does. (EPL pp. 31, 112, 113; ZPL pp. 155, 156.)
  • ZT, ZB becomes ^POI, ^PON. Which end of the image prints first. The EPL guide says the default, ZT, prints the top first, which the operator sees upside down. Zebra's ZPL reference, on its EPL legacy modes, calls ^PON "EPL ZB mode", so ZB is ^PON and ZT the other way, ^POI. We have not printed either. (EPL p. 170; ZPL pp. 322, 695.)

One label, translated

An EPL2 label for 4 × 2 inch stock with gaps, a box, a line of text, a rule and a Code 128 barcode, two copies:

epl

q812
Q406,24
N
X20,15,4,792,390
A40,30,0,4,2,2,N,"Rack 12, bay 3"
LO40,100,732,3
B40,130,0,1,2,2,100,B,"R12-B03"
P2

The same label in ZPL, a line for each EPL command:

zpl
^XA
^PW812
^LL406
^LH0,0
^MNY
^FO20,15^GB772,375,4^FS
^FO40,30^A0N,48^FDRack 12, bay 3^FS
^FO40,100^GB732,3,3^FS
^BY2^FO40,130^BCN,100,Y,N,N,A^FDR12-B03^FS
^PQ2
^XZ
  • The empty first line of the EPL is the line feed its guide asks for before N. ZPL needs none: ^XA starts the label.
  • q812 and Q406,24 became ^PW812, ^LL406 and ^MNY, labels with a gap. ^LH0,0 is what EPL's R0,0 would be; this EPL has no R, and uses q instead. It puts 0,0 back at the corner, which the label size guide explains, along with why ^LL does not change the length of labels with gaps.
  • The box's far corner, 792,390, became a width and height, 772 × 375. The boxes and lines guide covers ^GB.
  • B40,130,0,1,2,2,100,B became ^BY2 and ^BCN,100,Y,N,N,A: 2 dot modules, 100 dots tall, with its text under the bars. The Code 128 guide works out the width.
  • P2 became ^PQ2, before ^XZ. The print copies guide shows why after ^XZ it prints one.
  • The ZPL has no ^PO, and we left it out on purpose. The EPL has no Z, so by the EPL guide it prints ZT, its default (p. 170), which the map above makes ^POI. But the ZPL guide says a current printer powers on in ^PON, "EPL ZB mode", and that the older 2824 and 2844 printers default to ZB (p. 695). The two guides do not agree on which way your EPL printed, so print one label from each and add ^POI if the ZPL comes out upside down against the EPL.

What we could check

  • Labelary does not draw EPL. Sent the EPL above, its ZPL API answered 404: ERROR: Requested 1st label but ZPL generated no labels. So the EPL and the ZPL were never drawn side by side, and we do not say they print the same.
  • It drew the ZPL as 2 labels, for ^PQ2, each with 26,874 black dots. zxing-cpp read the barcode as R12-B03, and its bars ran from x 40 to 263.
  • That is Labelary's drawing, not a printed label. Print one and scan it before you replace the EPL.

What does not carry over

  • The fonts. EPL's fonts 1 to 5 are fixed-width dot fonts: font 4 at 203 dpi is 14 × 24 dots a character, and the multipliers stretch it. ZPL's font 0 is not one of them. At 48 dots, the height of font 4 doubled, our line of text was 282 dots wide in Labelary; in font 4 at 2 × 2 its 14 characters take 392. Match the height, then widen with ^A's width value: ^A0N,48,66 drew the same line 386 dots wide in Labelary. Print one to check. The font size guide converts points to dots and explains the width.
  • Special characters. EPL's data sits in quotes, with a backslash before a quote or a backslash. In ZPL a ^ or ~ in the data starts a command; the special characters guide shows how to print them with ^FH.
  • Centring. EPL's q centres a label narrower than the print head, and EPL's R turns that off and sets the margins itself; nothing in ^PW's reference centres. An EPL R value goes straight into ^LH. For EPL that relied on q, the offset it gave is (print head width - label width) / 2 dots: if the ZPL prints off to one side, move it that far with ^LH.
  • Graphics. GW's bytes can go into a ^GF as they are, but the EPL guide does not say whether a 1 bit is black or white. In ^GF a 1 is a black dot, as the logos and images guide shows; in the EPL Labelary wrote for us, below, a 0 was. Try one graphic before you convert them all, or make the ^GF again from the original image with the logos guide's script.
  • Stored forms, variables and counters. EPL keeps forms on the printer and fills them from data that follows. The templates guide covers ZPL's stored formats, and the multiple labels guide its serial numbers. We have not mapped one to the other.

Labelary converts the other way

Labelary's API can answer in EPL as well as PNG and PDF. Sent our ZPL with Accept: application/epl, it answered 36,396 bytes: N, then one GW16,15,97,375, a picture of the whole label, then P1.

  • Its bars were dot for dot the same as Labelary's PNG. 451 dots differed, along the edges of the text, mostly where the PNG is grey.
  • It is ZPL to EPL, as a picture, not EPL to ZPL. And it ended in P1, though the ZPL asked for two copies.
  • Everything you send goes to Labelary. The ZPL to PDF guide covers its plans and limits.

Printers that take both, and switching

The EPL guide says a Zebra G-Series printer takes EPL, ZPL and SGD commands without being told to switch, as long as each is sent as a separate file (EPL p. 177). The setting behind it is device.languages (EPL p. 184, ZPL p. 723). Ask the printer for it:

text
! U1 getvar "device.languages"

And set it to ZPL only:

text
! U1 setvar "device.languages" "zpl"
  • The ZPL guide gives the default as epl_zpl, both languages, and lists epl and zpl among the values. It says not every printer takes every value: ! U1 getvar "allcv" lists the ones yours does.
  • The EPL guide says setting it works only on G-Series printers. Its own example of the set line shows getvar; the line above is the ZPL guide's.
  • We have sent neither to a printer. Ask Zebra which languages your model takes before you rely on switching.

Or rebuild the label in a design tool

The accepted Stack Overflow answer designs the label again in ZebraDesigner, chooses a ZPL printer driver and prints to a file, which then holds the ZPL. That gives ZPL for a label you can redraw, not for EPL your code writes. We have not tried it.

The same 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 "copies": 2
5 },
6 "data": {
7 "location": "Rack 12, bay 3",
8 "code": "R12-B03"
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": "location",
21 "coords": [40, 30],
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}

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,30^FDRack 12, bay 3^FS
^FO40,100^GB732,3,3^FS
^BY2,2,59^FO40,130^BCN,100,Y,N,N,A^FDR12-B03^FS
^PQ2
^XZ

zeepler takes JSON, not EPL: a request is JSON, and its elements are Text, BarCode, QRCode, Line and Box. This request makes the label above, with copies for P2.

  • In Labelary it drew the same dots as the plain ZPL above, 2 labels, and zxing-cpp read R12-B03.
  • What it cannot do: read EPL, print a picture as GW does, reverse a field as LE or A's R do, draw a diagonal line, or print EPL's fonts. It makes six label sizes, all at 203 dpi, so an EPL label of another size has no match.

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.