Skip to content

How to print ZPL from a .txt file

Marketplaces and shipping platforms often deliver labels as ZPL code in a .txt file. Choose the option that fits your printer. To check the label before you print, paste the code into the ZPL viewer.

This option works with any printer. Follow these steps:

  1. Open the .txt file in a text editor and copy all of the text. The code starts with ^XA.
  2. Paste the code into the free ZPL to PDF converter and download the PDF.
  3. Print the PDF at 100% scale (Actual size). A smaller scale can make barcodes too small to scan. Use 4×6 in label stock on a thermal printer, or trim the label on a regular printer.

Most ZPL thermal printers accept raw print jobs on TCP port 9100. Follow these steps:

  1. Find your printer’s IP address. Most printers can print it from the feed-button menu.

  2. Run the command for your operating system, with PRINTER_IP replaced by the printer’s IP address.

    On macOS or Linux:

    Terminal window
    cat label.txt | nc PRINTER_IP 9100

    On Windows, in PowerShell:

    Terminal window
    Get-Content label.txt -Raw | ForEach-Object {
    $client = New-Object Net.Sockets.TcpClient("PRINTER_IP", 9100)
    $writer = New-Object IO.StreamWriter($client.GetStream())
    $writer.Write($_); $writer.Flush(); $writer.Close(); $client.Close()
    }
Section titled “Print through the Generic / Text Only driver on Windows”

If your thermal printer connects to Windows by USB, install it with the built-in Generic / Text Only driver and print the .txt file to it. The driver passes the ZPL to the printer unchanged. For setup steps, see Install a Windows printer for RAW label printing.