How to print ZPL from a .txt file
Marketplaces and shipping platforms often deliver labels as ZPL code inside a .txt file. You have three reliable ways to print it: convert to PDF and print anywhere, send the raw ZPL to a thermal printer over the network, or pass it through a generic printer driver. Pick based on the printer you have.
Option 1: Convert to PDF (works with any printer)
Section titled “Option 1: Convert to PDF (works with any printer)”Best when you don’t have a thermal printer, or just want the simplest path:
- Open the
.txtfile in a text editor and copy everything (it starts with^XA). - Paste it into the free ZPL to PDF converter and download the PDF.
- Print the PDF at 100% scale (“actual size”) — on a thermal printer with 4×6 in stock, or on a regular printer and trim.
Printing at reduced scale can make barcodes too small to scan — always use actual size.
Option 2: Send raw ZPL over the network (thermal printers)
Section titled “Option 2: Send raw ZPL over the network (thermal printers)”Most ZPL-capable thermal printers accept raw print jobs on TCP port 9100:
# macOS / Linuxcat label.txt | nc 192.168.1.50 9100# Windows PowerShellGet-Content label.txt -Raw | ForEach-Object { $client = New-Object Net.Sockets.TcpClient("192.168.1.50", 9100) $writer = New-Object IO.StreamWriter($client.GetStream()) $writer.Write($_); $writer.Flush(); $writer.Close(); $client.Close()}Replace 192.168.1.50 with your printer’s IP (printable from most printers’ feed-button menu).
Option 3: Generic / text-only driver (Windows + USB)
Section titled “Option 3: Generic / text-only driver (Windows + USB)”For a USB-connected thermal printer on Windows, install the printer with the built-in Generic / Text Only driver, then print the .txt file to it — the driver passes the ZPL through untouched instead of rasterizing it.
Check the label first
Section titled “Check the label first”Not sure the file is intact? Paste it into the ZPL viewer before printing — it renders exactly what will come out of the printer.