ZPL commands are the plain-text instructions that control every aspect of a Zebra label, from field placement and font selection to barcode encoding and print density. Label Toolkit gives you a free, browser-based environment to write, preview, and export ZPL without installing any software or buying a printer to test your output.
What Is ZPL and Why Does It Matter?
ZPL stands for Zebra Programming Language. Zebra Technologies introduced it in the 1980s as a way to describe label content in a concise, human-readable format. A label is defined by a block of text that opens with ^XA (start of label) and closes with ^XZ (end of label). Every instruction inside that block is a two-character command prefixed by a caret or a tilde.
ZPL II, the current iteration, is backward-compatible with the original and adds commands for scalable fonts, PDF417 barcodes, RFID encoding, and more. When people say "ZPL" today, they almost always mean ZPL II. The language runs natively on every modern Zebra thermal printer and is supported by a wide ecosystem of label management software and shipping platforms.
How a ZPL Label Is Structured
Every valid ZPL label follows a predictable skeleton. Understanding the structure makes reading and writing commands far less intimidating.
^XA
^PW609 ; Print width in dots (203 dpi x 3 inches)
^LL406 ; Label length in dots
^FO50,50 ; Field origin: X=50, Y=50
^A0N,40,40 ; Font A, normal orientation, 40x40 dots
^FDHello, World^FS ; Field data, field separator
^XZ
Each ^FO sets a coordinate origin. ^FD carries the actual data. ^FS closes the field. That three-command trio repeats for every text block, barcode, or graphic on the label. Once that pattern clicks, even a 200-line ZPL file becomes readable.
The Core ZPL Commands You Will Use Every Day
The full ZPL II specification runs to several hundred pages, but the vast majority of real-world labels rely on a relatively short list of commands. The table below covers the essentials.
| Command | Name | What It Does | Common Parameters |
|---|
^XA | Start Label | Opens a ZPL label block | None |
^XZ | End Label | Closes and queues the label for printing | None |
^FO | Field Origin | Sets the X,Y starting point of a field in dots | x, y, justification |
^FD | Field Data | Supplies the text or data to render | data string |
^FS | Field Separator | Closes an open field | None |
^A | Font | Selects a built-in or downloaded font and size | font ID, orientation, height, width |
^BY | Bar Code Field Default | Sets module width, ratio, and bar height for subsequent barcodes | module width, ratio, height |
^BC | Code 128 Bar Code | Renders a Code 128 barcode with optional HRI text | orientation, height, print line, check digit mode |
^BQ | QR Code Bar Code | Renders a QR code at a specified magnification and error-correction level | orientation, model, magnification, error correction |
^PW | Print Width | Defines the printable width in dots | width in dots |
^LL | Label Length | Defines the label length in dots | length in dots |
^GB | Graphic Box | Draws a rectangle or line with a specified border thickness | width, height, border, color, corner rounding |
^PR | Print Rate | Controls print and slew speed | speed (1-14 ips) |
^MD | Media Darkness | Adjusts darkness/burn intensity from -30 to +30 | darkness value |
^PQ | Print Quantity | Prints multiple copies of the label | quantity, pause count, replicate, override |
Dots, DPI, and Getting Your Dimensions Right
Every measurement in ZPL is expressed in dots, not millimeters or inches. The conversion depends on your printer's resolution. A 203 dpi printer produces 203 dots per inch, so a 4-inch wide label is 812 dots wide. A 300 dpi printer stretches that same physical label to 1200 dots. Always confirm your printer's DPI before setting ^PW and ^LL, or your label content will shift or clip unexpectedly.
Common resolutions and their dot-per-inch equivalents:
| Resolution | Dots per inch | 4 x 6 inch label (dots) | Typical use |
|---|
| 203 dpi | 8 dots/mm | 812 x 1218 | Shipping labels, bin labels |
| 300 dpi | 11.8 dots/mm | 1200 x 1800 | Product labels, small text, retail |
| 600 dpi | 23.6 dots/mm | 2400 x 3600 | Jewelry tags, circuit-board labels |
Barcodes in ZPL: Choosing the Right Symbology
ZPL supports more than 30 barcode symbologies out of the box. The command you use determines the symbology, and the parameters control size, orientation, and human-readable text. Here are the most requested ones:
- Code 128 (
^BC): The workhorse for shipping and logistics. Variable length, alphanumeric, used in GS1-128 labels for FedEx, UPS, and USPS. - QR Code (
^BQ): A 2D matrix code that stores up to 4,296 characters. Error correction levels L, M, Q, and H let you balance capacity against damage tolerance. - Code 39 (
^B3): Older, self-checking, uppercase alphanumeric only. Still common in automotive and defense supply chains. - Data Matrix (
^BX): Compact 2D format popular in electronics and pharmaceutical labels where space is tight. - ITF-14 (
^BI): A 14-digit interleaved 2-of-5 code printed on outer cartons to encode GTINs. - EAN-13 and UPC-A (
^BE, ^BU): Point-of-sale retail barcodes found on almost every consumer product.
Getting barcode sizing right matters for scannability. The ^BY command sets the global module width (the width of the narrowest bar) in dots. A module width of 2 at 203 dpi equals roughly 0.25 mm, which is the GS1 minimum for many symbologies. Going below that risks scan failures, especially at distance.
ZPL vs. EPL: Which Language Does Your Printer Speak?
Zebra printers made before roughly 2003 often used EPL (Eltron Programming Language) rather than ZPL. EPL uses a completely different syntax, line-based rather than field-based, and the two are not interchangeable. If you send ZPL to an EPL printer, it will print gibberish or nothing at all. Check your printer's configuration label (hold the feed button at power-on) to confirm the firmware language before writing any code.
Designing Labels Visually and Exporting ZPL
Writing ZPL by hand is powerful, but it is not the fastest path for every label. Label Toolkit's browser-based label designer lets you drag and drop text fields, barcodes, QR codes, and shapes onto a canvas, then exports the result as clean ZPL ready to send to your Zebra printer. No plugin, no desktop app, no license fee to get started.
The designer also supports PDF export for non-Zebra printers and data merge from CSV or spreadsheet files, so you can generate hundreds of unique labels from a single template. You can read more about data merge capabilities in our documentation.
Common ZPL Mistakes and How to Fix Them
Labels Print Blank
The most frequent cause is a missing ^XA or ^XZ. Every label block must have both. A typo in the opening command means the printer never enters label mode.
Barcode Will Not Scan
Check your module width via ^BY. If the bars are too narrow relative to your printer's DPI, a scanner's beam cannot resolve them. Also verify that the quiet zone (the blank margin on each side of a barcode) meets the symbology's minimum, typically 10x the module width for Code 128.
Text Is Cut Off on the Right
Your ^PW value may be narrower than your label or the field origin plus text width exceeds it. Recalculate using dots-per-inch for your specific printer resolution.
Fields Are Misaligned After Switching Printers
Almost always a DPI mismatch. A label designed for a 203 dpi printer will print 48% larger on a 300 dpi printer because the dot pitch is different. Always store the target DPI alongside your ZPL template.
What to Explore Next in the ZPL Reference
This hub is the starting point for a growing library of per-command articles. Each spoke page covers one command in depth: exact syntax, all parameters and their defaults, real-world use cases, and copy-ready ZPL snippets. The cluster covers everything from basic field positioning all the way through RFID encoding and firmware-level configuration commands.
Articles are sequenced from the commands you will use on day one through to advanced formatting and printer-management instructions. Start with ^FO, ^FD, and ^FS if you are new to ZPL, then work outward to barcode commands once your layout is solid.
If you are evaluating how ZPL fits into a larger printing workflow, the Label Toolkit blog covers topics including data merge from spreadsheets, hardware selection for direct thermal versus thermal transfer, and integrating label generation into shipping pipelines.
Start Designing Zebra Labels for Free
You do not need a Zebra printer on your desk to start learning ZPL. Label Toolkit renders a live preview of your label in the browser so you can iterate on layout, font sizes, and barcode parameters before touching a single sheet of media. When you are ready to print, export to ZPL and send directly to your printer over USB, Ethernet, or Bluetooth.
Create your free account and open your first label in under two minutes. Sign up for Label Toolkit and start building Zebra-ready labels today.
Related reading: What Is ZPL II: The Complete Guide to Zebra Programming Language
Related reading: ZPL Command Reference: ^XA and ^XZ (Label Home and End)