Launch

30% off your first month of Pro30% off month one$9.90 → $6.93

See plans
ZPL em PDF

Reference · ZPL

ZPL command reference

ZPL is a small language with an intimidating surface: two characters after a caret, positional arguments with no names, and a manual that runs to several hundred pages. In practice a shipping label uses about twenty commands, and once you can read those, the rest of the file stops being a wall of symbols. Every entry below comes with a complete label — not a fragment — that you can paste into the converter on this page and see rendered.

Checked on August 24, 2026

How to read a line of ZPL

A label starts at ^XA and ends at ^XZ. In between, every instruction begins with a caret and two letters, followed by comma-separated arguments in a fixed order — there are no argument names, so position is everything and an empty slot between two commas means “keep the default”.

Take ^FO50,120^A0N,40,40^FDACME Ltd^FS. That is: put the next field 50 dots across and 120 down; use font 0, not rotated, 40 dots tall and 40 wide; the content is “ACME Ltd”; end of field. Four commands, one line of a label.

Two details cause most of the confusion. Everything is measured in printer dots rather than millimetres, so the same file is a different physical size at 203 and 300 dpi — which is why the density selector matters. And ^FS is not optional decoration: leave it out and the next command is read as more of the previous field's data, which is why a broken label so often renders as one long run of text.

Why every command here carries an example

Because a reference for a renderer should be checkable against that renderer. Each example below is run through this site's own engine by a test, and the result is compared with the support column — so a command described as rendered that the engine silently drops fails our build instead of wasting your afternoon.

That is also why commands we do not implement are listed rather than omitted. A support matrix showing only the wins tells you nothing about the label in front of you; knowing that ^BZ will warn and skip is the useful half.

Every example on this page is a complete label. They are not illustrations: a test renders each one through the same engine this site runs on and checks the result against the support column, so a command marked “Rendered” that the engine ignored would fail the build rather than mislead you here.

Label structure

Where a label begins and ends, and how one file comes to hold a hundred of them.

  • ^XA

    Start Format

    Rendered

    Opens a label. Everything until the matching ^XZ describes one printed label, so a file with fifty ^XA blocks prints fifty labels.

    ^XA^FO50,50^A0N,40,40^FDFirst label^FS^XZ
  • ^XZ

    End Format

    Rendered

    Closes the label and prints it. A file missing its final ^XZ still renders here.

    ^XA^FO50,50^A0N,40,40^FDLast label^FS^XZ
  • ^FS

    Field Separator

    Rendered

    Ends the current field. Forget it and the next command is read as more of the previous field's data, which is the single most common reason a label renders as one long line of text.

    ^XA^FO50,50^A0N,40,40^FDName^FS^FO50,110^A0N,40,40^FDAddress^FS^XZ
  • ^FX

    Comment

    Rendered

    A comment, ignored by the printer. It still needs a ^FS to close it, and a missing one silently swallows the commands that follow.

    ^XA^FXOrder header^FS^FO50,50^A0N,40,40^FDACME Ltd^FS^XZ
  • ^DF

    Download Format

    Rendered

    Stores the rest of the label in printer memory as a template instead of printing it. The ^FN placeholders inside it are filled in later by ^XF.

    ^XA^DFR:TPL.ZPL^FS^FO50,50^A0N,40,40^FN1^FS^XZ^XA^XFR:TPL.ZPL^FS^FN1^FDACME Ltd^FS^XZ
  • ^XF

    Recall Format

    Rendered

    Recalls a stored ^DF template and prints it with this label's ^FN values. Carrier files use it heavily: the layout is uploaded once, then each label is just the data.

    ^XA^DFR:TPL.ZPL^FS^FO50,50^A0N,40,40^FN1^FS^XZ^XA^XFR:TPL.ZPL^FS^FN1^FDOrder 4471^FS^XZ
  • ^FN

    Field Number

    Rendered

    A numbered placeholder inside a stored format, and the value that fills it when the format is recalled.

    ^XA^DFR:TPL.ZPL^FS^FO50,50^A0N,40,40^FN7^FS^XZ^XA^XFR:TPL.ZPL^FS^FN7^FDSão Paulo^FS^XZ

Label setup

How big the label is, where its origin sits and how many come out.

  • ^PW

    Print Width

    Rendered

    The label's width in dots. With ^LL it is how a renderer knows the label's size at all — a file with neither leaves the canvas to be inferred from what is drawn.

    ^XA^PW812^LL1218^FO50,50^A0N,40,40^FD4 x 6 at 203 dpi^FS^XZ
  • ^LL

    Label Length

    Rendered

    The label's length in dots. At 8 dpmm a 6-inch label is 1218 dots; at 12 dpmm the same label is 1827.

    ^XA^PW812^LL1218^FO50,50^A0N,40,40^FDSix inches long^FS^XZ
  • ^LH

    Label Home

    Rendered

    Moves the origin every ^FO is measured from. Used to nudge a whole layout when the stock is loaded slightly off.

    ^XA^LH30,30^FO50,50^A0N,40,40^FDShifted origin^FS^XZ
  • ^LS

    Label Shift

    Rendered

    Shifts every field horizontally by a fixed number of dots.

    ^XA^LS20^FO50,50^A0N,40,40^FDShifted right^FS^XZ
  • ^LT

    Label Top

    Rendered

    Shifts the label vertically, in dot rows.

    ^XA^LT10^FO50,50^A0N,40,40^FDNudged down^FS^XZ
  • ^PQ

    Print Quantity

    Rendered

    How many copies of this label to print. It is why one ^XA block can become twelve pages of a PDF.

    ^XA^PQ3^FO50,50^A0N,40,40^FDThree copies^FS^XZ
  • ^PO

    Print Orientation

    Rendered

    ^POI turns the finished label 180°. ^PON leaves it alone.

    ^XA^POI^FO50,50^A0N,40,40^FDUpside down^FS^XZ
  • ^LR

    Label Reverse Print

    Rendered

    Inverts every field on the label — white on black. Implemented as an XOR against what is already there, which is what makes overlapping reversed fields behave the way a printer's do.

    ^XA^LRY^FO50,50^GB300,80,80^FS^FO70,70^A0N,40,40^FDREVERSED^FS^XZ
  • ^CI

    Change International Font

    Rendered

    Selects the character encoding for ^FD data. ^CI28 is UTF-8 and is what you want for accented text; without it a “ç” arrives as two mangled characters.

    ^XA^CI28^FO50,50^A0N,40,40^FDEndereço^FS^XZ

Position and orientation

Where the next field is drawn, which way up, and in which colour of ink.

  • ^FO

    Field Origin

    Rendered

    Places the next field at x,y in dots from the label's home corner. The workhorse: almost every line of a real label starts with one.

    ^XA^FO120,60^A0N,40,40^FDTop left^FS^XZ
  • ^FT

    Field Typeset

    Rendered

    Like ^FO, but y is the text baseline rather than the top of the character cell — so a row of ^FT fields lines up on the letters instead of on their boxes.

    ^XA^FT120,120^A0N,40,40^FDOn the baseline^FS^XZ
  • ^FW

    Field Orientation

    Rendered

    Sets the default rotation for the fields that follow: N normal, R 90°, I 180°, B 270°.

    ^XA^FWR^FO200,60^A0N,40,40^FDRotated^FS^XZ
  • ^FR

    Field Reverse Print

    Rendered

    Reverses just the next field, rather than the whole label the way ^LR does. Drawn as an XOR, so text over a black box comes out white.

    ^XA^FO40,40^GB320,90,90^FS^FO60,60^FR^A0N,40,40^FDWHITE ON BLACK^FS^XZ

Text and fonts

Choosing a face, a size, and how text wraps.

  • ^A

    Scalable / Bitmap Font

    Rendered

    Picks the font for this field. The designator is glued to the name — ^A0N,40,40 is font 0, not rotated, 40 dots tall. Font 0 is the scalable one everything else defaults to.

    ^XA^FO50,50^A0N,48,48^FDScalable font 0^FS^XZ
  • ^CF

    Change Default Font

    Rendered

    Sets the font every following field uses when it does not name one itself. Saves repeating ^A on thirty lines.

    ^XA^CF0,40^FO50,50^FDInherits the default^FS^FO50,110^FDSo does this^FS^XZ
  • ^FD

    Field Data

    Rendered

    The content of the field: the text to print, or the payload to encode if a barcode command came first. Everything up to ^FS is data, spaces and commas included.

    ^XA^FO50,50^A0N,40,40^FDAv. Exemplo, 1000^FS^XZ
  • ^FV

    Field Variable

    Rendered

    Field data that is cleared after the label prints, rather than persisting into the next one. Behaves like ^FD when rendering a single label.

    ^XA^FO50,50^A0N,40,40^FVOrder 4471^FS^XZ
  • ^FB

    Field Block

    Rendered

    Wraps the field's text inside a box of a given width and a maximum number of lines, with an alignment. This is how a long address becomes three tidy lines.

    ^XA^FO50,50^A0N,30,30^FB420,3,0,L^FDAv. Exemplo 1000, Bairro Modelo, Cidade Exemplo^FS^XZ
  • ^FH

    Field Hexadecimal Indicator

    Rendered

    Lets the following ^FD carry escaped bytes — _C3_A9 for “é”. How systems that cannot emit UTF-8 directly still produce accented labels.

    ^XA^CI28^FO50,50^A0N,40,40^FH^FDCaf_C3_A9^FS^XZ
  • ^SN

    Serialization Data

    Rendered

    Prints an incrementing number instead of fixed data — a starting value, a step and whether leading zeros are kept.

    ^XA^FO50,50^A0N,40,40^SN0001,1,Y^FS^XZ

Barcodes

One command selects the symbology, the ^FD that follows carries the payload, and ^BY sets the defaults they all inherit.

  • ^BY

    Bar Code Field Default

    Rendered

    Module width, wide-to-narrow ratio and height, inherited by every barcode after it. Change the module width and every bar on the label changes with it — the usual cause of a barcode that suddenly does not fit.

    ^XA^BY3,3,120^FO50,50^BCN,120,Y,N,N^FD1234567890^FS^XZ
  • ^BC

    Code 128

    Rendered

    The shipping barcode. Its leading subset invocation matters: a payload starting >: is encoded in subset B, which is how a carrier stops an all-digit tracking number collapsing into the half-as-wide subset C.

    ^XA^FO50,50^BCN,120,Y,N,N^FD1234567890^FS^XZ
  • ^B3

    Code 39

    Rendered

    One of the two symbologies with a wide and a narrow bar, so its width depends on the ^BY ratio as well as the module width.

    ^XA^FO50,50^B3N,N,120,Y,N^FDABC123^FS^XZ
  • ^B2

    Interleaved 2 of 5

    Rendered

    Numeric only, and encodes digits in pairs — an odd-length payload gets padded.

    ^XA^FO50,50^B2N,120,Y,N,N^FD12345678^FS^XZ
  • ^BA

    Code 93

    Rendered

    A denser relative of Code 39, occasionally used for internal warehouse labels.

    ^XA^FO50,50^BAN,120,Y,N,N^FDCODE93^FS^XZ
  • ^BE

    EAN-13

    Rendered

    Retail product code: twelve digits plus a check digit the encoder works out.

    ^XA^FO50,50^BEN,120,Y,N^FD590123412345^FS^XZ
  • ^B8

    EAN-8

    Rendered

    The short retail code, for packaging too small for an EAN-13.

    ^XA^FO50,50^B8N,120,Y,N^FD1234567^FS^XZ
  • ^BU

    UPC-A

    Rendered

    The North American retail code: eleven digits plus a check digit.

    ^XA^FO50,50^BUN,120,Y,N^FD01234567890^FS^XZ
  • ^B9

    UPC-E

    Rendered

    The compressed UPC, for packaging too small for a UPC-A. Seven digits, or eight if you supply the check digit yourself.

    ^XA^FO50,50^B9N,120,Y,N^FD0123456^FS^XZ
  • ^BQ

    QR Code

    Rendered

    Two dimensional, and its ^FD carries an error-correction prefix rather than plain data: QA, before the payload is the common form.

    ^XA^FO50,50^BQN,2,6^FDQA,https://example.com/track/4471^FS^XZ
  • ^BX

    Data Matrix

    Rendered

    Two dimensional and very compact — the square you see on electronics and pharmaceutical labels.

    ^XA^FO50,50^BXN,6,200^FDDATAMATRIX PAYLOAD^FS^XZ
  • ^B7

    PDF417

    Rendered

    The stacked symbology carriers use for the block of data under a shipping barcode. Its row height comes from this command rather than from ^BY.

    ^XA^FO50,50^B7N,3,5,0,0,N^FDPDF417 payload^FS^XZ
  • ^BK

    ANSI Codabar

    Warns

    Not implemented. The field is skipped and a warning names the command.

    ^XA^FO50,50^BKN,N,120,Y,N,A,A^FD12345^FS^XZ
  • ^BM

    MSI

    Warns

    Not implemented. The field is skipped and a warning names the command.

    ^XA^FO50,50^BMN,B,120,Y,N,N^FD1234^FS^XZ
  • ^BR

    GS1 DataBar

    Warns

    Not implemented. The field is skipped and a warning names the command.

    ^XA^FO50,50^BRN,1,1,3,,120^FD12345678901234^FS^XZ
  • ^BZ

    POSTNET

    Warns

    Not implemented. The field is skipped and a warning names the command.

    ^XA^FO50,50^BZN,120,Y,N^FD12345^FS^XZ

Graphics and shapes

Boxes, lines and the compressed bitmaps a converted PDF turns into.

  • ^GB

    Graphic Box

    Rendered

    A rectangle, or a line when one side is thinner than the border. Most rules and frames on a shipping label are ^GB.

    ^XA^FO50,50^GB420,140,4^FS^FO50,220^GB420,0,3^FS^XZ
  • ^GC

    Graphic Circle

    Rendered

    A circle of a given diameter and border thickness.

    ^XA^FO60,60^GC160,6,B^FS^XZ
  • ^GD

    Graphic Diagonal Line

    Rendered

    A diagonal, leaning right or left.

    ^XA^FO60,60^GD200,160,5,B,R^FS^XZ
  • ^GE

    Graphic Ellipse

    Rendered

    An ellipse, sized independently on each axis.

    ^XA^FO60,60^GE260,140,5,B^FS^XZ
  • ^GF

    Graphic Field

    Rendered

    An inline bitmap: ASCII hex, or the compressed Z64 form real files use. This is what a PDF or a photo becomes when it is converted to ZPL — one dithered image rather than editable fields.

    ^XA^FO60,60^GFA,16,16,2,FFFFC003C003C003C003C003C003FFFF^FS^XZ
  • ^XG

    Recall Graphic

    Rendered

    Draws an image previously uploaded with ~DG. Carrier files upload a logo once and then recall it on every label.

    ~DGR:LOGO.GRF,16,2,FFFFC003C003C003C003C003C003FFFF^XA^FO60,60^XGR:LOGO.GRF,1,1^FS^XZ

Printer settings

Commands about the hardware rather than the artwork. A renderer has no darkness setting and no ribbon, so these are consumed and have no effect on the image — which is correct, not a gap.

  • ^MD

    Media Darkness

    Accepted

    How hot the printhead runs. Affects the paper, never the image a renderer produces.

    ^XA^MD10^FO50,50^A0N,40,40^FDDarkness set^FS^XZ
  • ^MT

    Media Type

    Accepted

    Direct thermal or thermal transfer — a statement about the ribbon, not the artwork.

    ^XA^MTD^FO50,50^A0N,40,40^FDDirect thermal^FS^XZ
  • ^MN

    Media Tracking

    Accepted

    How the printer finds the gap between labels. Nothing to draw.

    ^XA^MNY^FO50,50^A0N,40,40^FDGap sensing^FS^XZ
  • ^MM

    Print Mode

    Accepted

    Tear-off, peel-off, cutter. A property of the machine.

    ^XA^MMT^FO50,50^A0N,40,40^FDTear off^FS^XZ
  • ^PR

    Print Rate

    Accepted

    Print, slew and backfeed speeds.

    ^XA^PR4^FO50,50^A0N,40,40^FDFour inches a second^FS^XZ
  • ^MC

    Map Clear

    Accepted

    Clears the printer's bitmap between labels. Worth knowing because a block that contains only housekeeping like this one — ^XA^MCY^XZ — is dropped rather than rendered as a blank page, which is why a carrier file of fifty labels yields fifty pages and not a hundred.

    ^XA^MCY^FO50,50^A0N,40,40^FDStill draws^FS^XZ
  • ^JU

    Configuration Update

    Accepted

    Saves or restores the printer's own settings.

    ^XA^JUS^FO50,50^A0N,40,40^FDSettings saved^FS^XZ

Paste any example above and watch it render

Drag the file in, paste the code, or pick it from your device

.txt · .zpl · .prn · .zip · .pdf · .png · .jpg — 30 labels a day

The conversion happens in your browser: your file never leaves your device.How that works
Free, no signupNo uploadNo watermarkBatches of many filesPDF · PNG · ZIP

Questions

Frequently asked questions

What does ^XA mean in ZPL?

^XA opens a label and ^XZ closes and prints it. Everything between them describes one printed label, so a file containing fifty ^XA blocks is fifty labels — which is what a day of orders downloaded in bulk looks like.

What is the difference between ^FO and ^FT?

Both place the next field, but they measure from different points: ^FO positions the top-left corner of the character cell, while ^FT positions the text baseline. A row of ^FT fields lines up on the letters themselves, which is usually what you want when mixing font sizes.

Why is my accented text wrong?

Almost always a missing ^CI28, which selects UTF-8 for the field data that follows. Without it the printer interprets the bytes in its own default encoding and a “ç” arrives as two mangled characters. The alternative is ^FH with escaped bytes, which is what systems that cannot emit UTF-8 use.

How do I change the size of a barcode?

^BY sets the module width, the wide-to-narrow ratio and the default height for every barcode after it, and each barcode command can override the height itself. Changing the module width scales every bar on the label at once — the usual reason a barcode suddenly stops fitting.

Does this renderer support every ZPL command?

No, and the table says which. Most format commands render, hardware commands such as ^MD and ^MT are accepted and have no effect on an image, and a handful of barcode symbologies warn and skip the field rather than drawing something wrong. Anything unrecognised raises a warning and the rest of the label still renders.

Where do the examples come from?

They are written by hand and verified mechanically: a test renders each one and asserts it behaves the way its row claims. If you find one that does not work in the converter above, that is a bug in the engine, not a typo on this page.

Other guides