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.
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.
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.
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
^XAand 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's official alphabetical ZPL II command documentation.
Open Zebra documentationMicrosoft's documentation for custom label layouts and ZPL examples in Dynamics 365 Supply Chain Management.
Open Microsoft LearnGuidance for ZPL-based license plate label layouts and routing.
Open Microsoft LearnOfficial GS1 guidance for barcode identification and data standards.
Open GS1 barcode standardsZPL 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.