ZPL Developer Reference

ZPL Commands Reference: Common Zebra Programming Language Codes

Use this practical ZPL command reference to understand the commands most often used to build Zebra-compatible labels with text, barcodes, QR codes, graphics, positioning, label dimensions, reusable formats, and printer settings.

ZPL, or Zebra Programming Language, uses short text commands to describe what a thermal label printer should produce. This page focuses on commands that are especially useful when creating, reading, troubleshooting, or maintaining warehouse, manufacturing, inventory, shipping, and ERP-generated labels.

How ZPL commands work

Most ZPL labels contain a series of commands surrounded by a start format command and an end format command. Commands beginning with a caret character are commonly used to define the label format. Commands beginning with a tilde are commonly used for printer control or immediate actions.

^XA Start format

Begins a ZPL label format.

^FO Field origin

Positions a field by X and Y coordinates.

^FD Field data

Supplies the value that the field will print or encode.

^XZ End format

Finishes the ZPL label format.

Simple ZPL label example

^XA
^PW812
^LL1218
^FO50,50^A0N,40,40^FDPrint Envoy^FS
^FO50,130^BY3
^BCN,100,Y,N,N
^FDPE-10001^FS
^FO50,280^GB700,300,3^FS
^XZ

This example creates a label format, specifies a print width and label length, prints text, creates a Code 128 barcode, draws a box, and then ends the format.

Important: ZPL coordinates and many dimensions are expressed in printer dots. A layout designed for a 203 DPI printer can have a different physical size when printed on a 300 DPI printer unless its dimensions are adjusted.

Common ZPL command reference

This is a practical reference for frequently used ZPL II commands. It is not intended to replace the complete Zebra programming documentation. Printer firmware, model capabilities, installed fonts, memory, and supported features can affect command behavior.

^XA
Structure
Start Format
Begins a ZPL label format. Normal ZPL label definitions start with this command.
^XA
^XZ
Structure
End Format
Ends the current ZPL format and completes the label definition.
^XZ
^FS
Structure
Field Separator
Ends the current field. It is commonly placed after field data, barcodes, graphics, and other field definitions.
^FDItem A100^FS
^FX
Structure
Comment
Adds a comment to ZPL source code without printing the comment on the label.
^FX Item barcode section
^PQ
Structure
Print Quantity
Controls how many copies of the label are printed and provides additional quantity-related options.
^PQ4
^FO
Layout
Field Origin
Sets the X and Y position of a field relative to the label origin.
^FO50,100
^FT
Layout
Field Typeset
Positions a field using the field typesetting origin. It is often found in generated label layouts.
^FT50,150
^LH
Layout
Label Home
Changes the label coordinate origin and can shift all following field positions.
^LH20,20
^PW
Layout
Print Width
Defines the intended print width in dots.
^PW812
^LL
Layout
Label Length
Sets the label length in dots. It is especially important for continuous media and fixed label geometry.
^LL1218
^LS
Layout
Label Shift
Shifts label content horizontally and is useful when compensating for placement differences.
^LS10
^LT
Layout
Label Top
Adjusts the vertical label position relative to the printer's normal top position.
^LT10
^FW
Layout
Field Orientation
Sets a default orientation for following fields.
^FWN
^PO
Layout
Print Orientation
Controls normal or inverted print orientation for the label.
^PON
^A0
Text
Scalable Font 0
Selects built-in scalable font 0 and specifies orientation, height, and width.
^A0N,40,40
^CF
Text
Change Default Font
Sets a default font and size so the same font settings do not need to be repeated on every field.
^CF0,30
^FD
Text
Field Data
Provides the text, barcode value, or other data used by the current field.
^FDWarehouse A^FS
^FB
Text
Field Block
Formats text into a block with width, line count, spacing, and alignment options.
^FB500,3,5,L,0
^FH
Text
Field Hexadecimal Indicator
Allows hexadecimal character values to be included in field data using a selected escape character.
^FH\
^CI
Text
Change International Font or Encoding
Selects the character set or encoding used by following text. ^CI28 is commonly used with Unicode and UTF-8 workflows.
^CI28
^BY
Barcode
Barcode Field Default
Sets defaults such as module width, wide-to-narrow ratio, and barcode height for following barcode fields.
^BY3,2,100
^BC
Barcode
Code 128 Barcode
Creates a Code 128 barcode. Code 128 is widely used for warehouse, inventory, logistics, and shipping labels.
^BCN,100,Y,N,N
^B3
Barcode
Code 39 Barcode
Creates a Code 39 barcode, also called Code 3 of 9.
^B3N,N,100,Y,N
^BQ
Barcode
QR Code
Creates a QR Code field. Magnification and QR settings can be adjusted for the intended scanner and label size.
^BQN,2,6
^BX
Barcode
Data Matrix Barcode
Creates a Data Matrix symbol for compact 2D encoding.
^BXN,8,200
^B7
Barcode
PDF417 Barcode
Creates a PDF417 stacked barcode with configurable height, security, columns, rows, and other parameters.
^B7N,5,5,7,N
^GB
Graphics
Graphic Box
Draws a rectangle or box. It can also be used to create horizontal and vertical lines.
^GB500,200,3,B,0
^GC
Graphics
Graphic Circle
Draws a circle with configurable diameter, line thickness, and color.
^GC100,3,B
^GD
Graphics
Graphic Diagonal Line
Draws a diagonal line inside a defined width and height.
^GD200,100,3,B,R
^GE
Graphics
Graphic Ellipse
Draws an ellipse with a defined width, height, thickness, and color.
^GE200,100,3,B
^GF
Graphics
Graphic Field
Embeds graphic data directly into the label format.
^GFA,...
~DG
Graphics
Download Graphic
Downloads and stores a graphic in printer memory so it can be recalled later.
~DGR:LOGO.GRF,...
^XG
Graphics
Recall Graphic
Recalls a previously stored graphic and optionally scales it.
^XGR:LOGO.GRF,1,1
^DF
Template
Download Format
Stores a label format in printer memory so it can be reused.
^DFR:ITEMLBL.ZPL
^XF
Template
Recall Format
Loads a previously stored format for printing with variable data.
^XFR:ITEMLBL.ZPL
^FN
Template
Field Number
Assigns a field number so variable values can later be supplied to reusable formats.
^FN1^FS
^FV
Template
Field Variable
Supplies variable field data in workflows that use numbered fields and stored formats.
^FVITEM-1001^FS
^PR
Printer
Print Rate
Controls printer speed-related settings. Supported values depend on the printer model.
^PR4
~SD
Printer
Set Darkness
Sets printer darkness. Valid settings and resulting print quality depend on the printer and media.
~SD15
^MD
Printer
Media Darkness Adjustment
Applies an adjustment to darkness for the current format.
^MD5
^MM
Printer
Print Mode
Selects a supported print mode such as tear-off, peel, cutter, or other printer-specific media handling modes.
^MMT

Practical ZPL examples

Print basic text

^XA
^FO50,50
^A0N,40,40
^FDHello from Print Envoy^FS
^XZ

The field starts at X 50 and Y 50. Font 0 is used at 40 dots high and 40 dots wide.

Print a Code 128 barcode

^XA
^FO50,50
^BY3
^BCN,100,Y,N,N
^FDPE-10001^FS
^XZ

^BY sets barcode defaults, ^BC selects Code 128, and ^FD contains the encoded value.

Print a QR Code

^XA
^FO50,50
^BQN,2,6
^FDLA,https://printenvoy.com/^FS
^XZ

QR Code sizing should be tested at the final printer resolution and with the scanners used in production.

Draw a border

^XA
^FO25,25
^GB750,1150,4,B,0^FS
^XZ

A graphic box can be used for borders, panels, separators, and simple horizontal or vertical rules.

Create a 4 x 6 label at 203 DPI

^XA
^PW812
^LL1218
^FO40,40
^A0N,36,36
^FD4 x 6 ZPL Label^FS
^XZ

Four inches multiplied by 203 DPI equals 812 dots. Six inches multiplied by 203 DPI equals 1218 dots.

Add multi-line text

^XA
^FO40,40
^A0N,30,30
^FB600,4,5,L,0
^FDThis text can wrap across multiple lines inside a defined field block.^FS
^XZ

^FB is useful for descriptions, addresses, instructions, and other variable-length text.

Want to inspect the rendered output? Paste any of these examples into the Print Envoy ZPL Visualizer Tool.

ZPL label dimensions at 203 DPI and 300 DPI

ZPL commonly uses dots rather than inches or millimeters for positioning and sizing. The same dot count therefore represents a different physical distance at different printer resolutions.

Label size 203 DPI 300 DPI 600 DPI
4 x 6 inches 812 x 1218 dots 1200 x 1800 dots 2400 x 3600 dots
4 x 4 inches 812 x 812 dots 1200 x 1200 dots 2400 x 2400 dots
4 x 1 inch 812 x 203 dots 1200 x 300 dots 2400 x 600 dots
2 x 1 inch 406 x 203 dots 600 x 300 dots 1200 x 600 dots

These calculations describe nominal dimensions. Always confirm the printer's printable width, label stock, margins, calibration, and actual printer resolution before moving a label into production.

ZPL in Microsoft Dynamics 365 label printing

ZPL is also relevant outside standalone label design. Microsoft Dynamics 365 Supply Chain Management documentation includes ZPL-based examples for custom labels, license plate labels, container labels, and warehouse label printing.

In an ERP-generated label workflow, business data such as item numbers, locations, license plates, quantities, shipments, production information, or serial numbers can be inserted into a label layout before the resulting printer instructions are sent to the selected printer.

Print Envoy focuses on connecting label printing to Microsoft Dynamics 365 business processes, routing, label engines, printers, and operational workflows. Developers and administrators can use the ZPL Visualizer when they need to inspect or troubleshoot generated ZPL before sending it to physical printing equipment.

Common ZPL troubleshooting checks

Nothing prints

  • Confirm that the label starts with ^XA and ends with ^XZ.
  • Check that the printer supports ZPL or an appropriate ZPL emulation.
  • Confirm that the code reaches the intended printer.
  • Separate source-code problems from printer connectivity problems.

Text or barcodes are in the wrong position

  • Check ^FO, ^FT, ^LH, ^LS, and ^LT.
  • Verify the intended print width and label length.
  • Confirm the printer is using the expected DPI.

A barcode will not scan

  • Check the barcode type and data requirements.
  • Review module width, barcode height, and available quiet space.
  • Confirm the symbol has not been compressed to fit an unsuitable area.
  • Validate the final output with the scanner and media used in production.
  • If GS1 data is required, verify the data structure against the applicable GS1 standard.

A preview and printed label do not look identical

Browser rendering can help identify ZPL syntax and layout issues, but physical output can also be affected by printer firmware, calibration, darkness, speed, printhead resolution, installed fonts, media, ribbon, sensor configuration, and hardware-specific behavior.

Authoritative ZPL and barcode resources

Use these resources when you need complete command parameters, device-specific behavior, Microsoft Dynamics 365 configuration guidance, or barcode standards.

Zebra ZPL Commands

Zebra's official alphabetical ZPL II command documentation.

Open Zebra documentation
Microsoft D365 Custom Label Layouts

Microsoft's documentation for custom label layouts and ZPL examples in Dynamics 365 Supply Chain Management.

Open Microsoft Learn
Microsoft D365 License Plate Labels

Guidance for ZPL-based license plate label layouts and routing.

Open Microsoft Learn
GS1 Barcode Standards

Official GS1 guidance for barcode identification and data standards.

Open GS1 barcode standards

ZPL command FAQ

What command starts a ZPL label?

^XA begins a ZPL label format. A normal label format ends with ^XZ.

What is ^FO in ZPL?

^FO means Field Origin. It specifies the X and Y coordinates where the current field begins.

What is ^FD in ZPL?

^FD means Field Data. It supplies the value used by a text field, barcode, or another field type.

Which ZPL command creates a Code 128 barcode?

^BC creates a Code 128 barcode. ^BY is often used with it to control barcode sizing defaults.

Which ZPL command creates a QR Code?

^BQ creates a QR Code field.

Why does ZPL change between 203 DPI and 300 DPI?

ZPL positioning and many dimensions use dots. A 203 DPI printer has 203 dots per inch, while a 300 DPI printer has 300 dots per inch, so the same dot values represent different physical dimensions.

Can non-Zebra printers use ZPL?

Some non-Zebra thermal printers support ZPL-compatible modes or emulation. Command coverage and behavior can vary, so test important labels on the actual printer model used in production.

Can I test ZPL without a printer?

Yes. Use the Print Envoy ZPL Visualizer Tool to render supported ZPL in your browser and inspect the expected label layout.

Test the ZPL commands on this page

Paste your label code into the free Print Envoy ZPL Visualizer to preview text, barcode placement, graphics, label dimensions, and supported ZPL output before sending the label to a physical printer.

Print Envoy is developed by a specialized team within Cloud Inventory®, the same organization behind ScanWorkX and other enterprise solutions. Our Print Envoy experts are fully integrated into Nextworld’s mission of pushing the boundaries of ERP innovation and automation. Want to explore our full suite of offerings? Visit CloudInventory.com to learn how Cloud Inventory is transforming business operations across industries.

Our Companion Product

Stay Updated
Subscribe to our newsletter for the latest updates and insights on Print Envoy.

© 2026 Print Envoy. All rights reserved.