DEVELOPERS / ZPL / UPDATED 16 NOV 2026

Send ZPL to a Zebra Printer: Five Ways, Each With the Command

Send ZPL to a Zebra printer over port 9100 with nc, PowerShell, Python or Node.js, a Windows share, CUPS or an API. Commands were run; the result is shown.

FREE PLAN · NO CREDIT CARD · WINDOWS / MAC / ANDROID / WEB
label.zplZPL / 49 BYTES
^XA^FO50,50^A0N,40,40^FDHello from LabelInn^FS^XZ
send itSHELL
nc 192.168.1.50 9100 < label.zpl
THE LABEL THOSE 49 BYTES MAKELAYOUT DRAWING
Layout drawing of the label made by the ZPL above: the words Hello from LabelInn
Drawn from the ZPL above by the layout viewer on this site. The printer draws the text with its own font.
ON THIS PAGE 5 ways, one test label Port 9100 in 4 languages Why it prints as text Windows, Mac, Linux

SHORT ANSWER

A Zebra wants the ZPL as raw bytes, unchanged.

On the same network that is TCP port 9100: nc 192.168.1.50 9100 < label.zpl. Nothing converts the file, so no driver is needed. If the sender cannot reach the printer (a cloud server, a USB printer, another site), post the ZPL to the LabelInn API and the app next to the printer delivers it.

  • Routes 1 to 4 need nothing from LabelInn: a shell, PowerShell, a share or CUPS.
  • Route 5 adds a queue, a job status and USB printers, and works from any server.
  • Every command below is the text that was run, with its result.
FIVE ROUTES TO ONE PRINTERDIAGRAM
Five ways to send ZPL to a Zebra printer: nc to port 9100, copy /B to a shared Windows printer, lp -o raw to a CUPS queue, your own code to port 9100, and the LabelInn API from anywhere

01 / DECISION

Which route fits where you send from

Find your situation in the left column.

You are sending fromUseWhy
A PC, Mac or Linux box on the printer’s networkRoute 1, port 9100Shortest path: one command, no software, no driver.
A Windows PC where the Zebra is installed (USB or network)Route 2, copy /B to the shareUses the queue Windows already has; binary mode keeps the bytes.
A Mac or Linux PC with the printer in CUPSRoute 3, lp -o rawSkips the CUPS filters that would turn ZPL into a page.
A script or service you are writingRoute 4, a socket in your languageSame as route 1, from code. Set a timeout.
A cloud server, another site, or a USB printer on a PC you cannot reachRoute 5, the LabelInn APIOnly one that works across networks and also gives you a job status.

02 / DIRECT

Routes 1 to 4: straight to the printer

Raw bytes, no driver. The PowerShell snippet was run; the others follow documented behaviour.

ROUTE 1 / MAC, LINUX, GIT BASH

nc to port 9100

shellSHELL
nc 192.168.1.50 9100 < label.zpl

Not run nc is not installed on the Windows test PC. The socket snippets below send the same bytes and were run.

no nc? bash aloneBASH
cat label.zpl > /dev/tcp/192.168.1.50/9100

Run in bash 5.2 against the local listener: 49 bytes, same SHA-256. Bash only; zsh and dash have no /dev/tcp.

ROUTE 1 / WINDOWS

PowerShell TcpClient to port 9100

send-9100.ps1POWERSHELL
$printer = "192.168.1.50"   # the printer's IP address
$port    = 9100
$bytes   = [System.IO.File]::ReadAllBytes("label.zpl")
$client  = New-Object System.Net.Sockets.TcpClient($printer, $port)
$client.GetStream().Write($bytes, 0, $bytes.Length)
$client.Close()

Run against a local listener: 49 bytes in, 49 bytes out, same SHA-256 as the file.

ROUTE 2 / WINDOWS SHARE

copy /B to a shared printer

cmdCMD
copy /B label.zpl \\localhost\ZebraShare

Not run Needs a shared Windows printer. /B copies in binary mode, so nothing is translated. Share the printer under a short name with no spaces.

ROUTE 3 / CUPS

lp with the raw option

shellSHELL
lp -d Zebra_ZD421 -o raw label.zpl

Not run Needs CUPS and a queue (lpstat -p lists them). -o raw skips CUPS filters, so the file reaches the printer untouched.

03 / CODE

The same thing from code

Python and Node.js, both run against a listener that stands in for port 9100.

Python

Open the file in binary mode and send the bytes.

send-9100.pyPYTHON
import socket

PRINTER = ("192.168.1.50", 9100)   # the printer's IP address and raw port

with open("label.zpl", "rb") as f:        # "rb": bytes, unchanged
    zpl = f.read()

with socket.create_connection(PRINTER, timeout=5) as s:
    s.sendall(zpl)

Node.js

send-9100.mjsNODE.JS
import net from "node:net";
import { readFileSync } from "node:fs";

const zpl = readFileSync("label.zpl");           // a Buffer: bytes, unchanged
const socket = net.connect({ host: "192.168.1.50", port: 9100 }, () => {
  socket.end(zpl);                                // write, then close
});
socket.setTimeout(5000, () => socket.destroy(new Error("printer did not answer in 5 s")));
socket.on("error", (e) => console.error("send failed:", e.message));
listener (stand-in for port 9100)RUN OUTPUT
listener on 19100
$ python send-9100.py          (host and port pointed at the listener)
listener: 49 bytes, first 3 hex 5e5841, last 3 hex 5e585a
$ node send-9100.mjs
listener: 49 bytes, first 3 hex 5e5841, last 3 hex 5e585a
$ powershell -File send-9100.ps1
listener: 49 bytes, first 3 hex 5e5841, last 3 hex 5e585a

sha256 of label.zpl and of the three received files:
0dbcaa09181b5083...   identical
What this proves and what it does not

The printer side was a small TCP listener on this PC, not a Zebra. It shows the bytes that leave your code are the bytes of the file (5e5841 is ^XA, 5e585a is ^XZ). Port 9100 accepts bytes whether or not the ribbon is out, so only a printer status query tells you a label came out.

04 / CHECK

See the label before you send it

A drawing of the ZPL, and what each line does.

This label is 80 x 50 mm at 203 dpi (^PW640 is 640 dots, ^LL400 is 400). Each field is one ^FO (where) and one ^FD ... ^FS (what). ^BC is a Code 128 barcode with its text under it. ^CI28 makes the printer read UTF-8, so accented names survive.

order-label.zplZPL
^XA
^CI28
^PW640
^LL400
^FO30,30^A0N,44,44^FDOrder 10492^FS
^FO30,90^A0N,30,30^FDMaria Lopez, Rotterdam^FS
^FO30,150^BY3^BCN,120,Y,N^FD10492-A1^FS
^FO30,330^A0N,26,26^FD2 of 3 boxes^FS
^XZ

Paste your own ZPL into the free ZPL viewer and validator: it draws the label to scale, in your browser, and lists mistakes such as a missing ^XZ or a field past the print width. It never uploads the ZPL.

80 X 50 MM / 203 DPILAYOUT DRAWING
Layout drawing of an 80 by 50 mm label: Order 10492, Maria Lopez, Rotterdam, a Code 128 barcode reading 10492-A1 and the line 2 of 3 boxes
Drawn from the ZPL on the left by the same interpreter as the ZPL viewer. Barcode modules are exact; the text uses a stand-in font.

05 / TROUBLESHOOT

When it prints as text, nothing, or the wrong thing

Most failures come from something touching the bytes on the way.

RAW OR DRIVERWHY ZPL PRINTS AS TEXT
A raw path delivers the ZPL bytes to the printer, which builds the label. A driver path renders the file as a page, so the printer prints the ZPL source as text
What you seeUsual causeWhat to do
The ZPL itself prints as textA driver or a normal print queue turned the file into a page before it reached the printer.Send raw: port 9100, copy /B, or lp -o raw.
Nothing happensThe file does not start with ^XA or end with ^XZ; the wrong IP or port; the printer is paused or shows an error (head open, out of paper).Check the printer’s own light first, then the file in the viewer, then ping the address.
A stray character, or the label is ignoredThree bytes EF BB BF (a UTF-8 byte order mark) sit in front of ^XA. Windows PowerShell 5.1 writes them with Out-File -Encoding utf8.Save without a BOM. The bytes are shown below.
Accents are wrongThe printer reads another code page, or the font has no such glyph.Start the label with ^CI28 and send UTF-8. The byte for è is c3 a8 in UTF-8, e8 in cp1252 and 8a in cp850.
Wrong size or positionThe label did not set its own size, so the printer used the last stored width and length.Put ^PW and ^LL in the file, and calibrate the media if labels skip.

This is the BOM trap, run on this PC. Windows PowerShell 5.1 and PowerShell 7 write the same text differently:

  • Windows PowerShell 5.1, Out-File -Encoding utf8: starts with ef bb bf.
  • PowerShell 7 (pwsh) with the same command: starts with 5e 58 41, no BOM.
  • Windows PowerShell 5.1, Set-Content -Encoding ascii: no BOM either.

Both add a closing line break (0d 0a) after ^XZ. That is harmless. We did not test with a physical Zebra how each model reacts to the three leading bytes, so the safe rule is to send none.

hex of the first bytesRUN OUTPUT
PowerShell 5.1.19041   Out-File -Encoding utf8
ef bb bf 5e 58 41 5e 46 ...           <- BOM, then ^XA

PowerShell 7.6.9       Out-File -Encoding utf8
5e 58 41 5e 58 5a 0d 0a               <- ^XA ^XZ CR LF

PowerShell 5.1         Set-Content -Encoding ascii
5e 58 41 5e 58 5a 0d 0a

06 / API

From anywhere: the LabelInn API

One HTTPS call, a queue, a job status.

CLOUD PATHDIAGRAM
Your server posts a job over HTTPS to the LabelInn cloud queue; the LabelInn app next to the printer connects out, takes the job and sends the ZPL to the Zebra

Use this when the sender cannot reach the printer. A cloud server cannot open port 9100 on a warehouse LAN, a USB Zebra has no port at all, and port 9100 never tells you whether anything printed.

LabelInn runs next to the printer and connects out to the cloud. Your code calls one HTTPS endpoint; the job is queued, and the app sends the ZPL to the printer exactly as you wrote it, over USB or the network, then reads the printer’s status back. A job for a printer that is switched off waits and prints when it is back.

  • payload_data holds the ZPL, up to 500 KB.
  • copies (1 to 1000) repeats the label in one write.
  • X-Idempotency-Key makes a retried request return the first job instead of printing twice.
  • ZPL sent to a receipt or raster-only printer is refused with 400 PRINTER_LANGUAGE_MISMATCH instead of printing junk.
send-zpl.shSHELL
curl https://labelinn.com/v1/print/jobs \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: label-10492-1" \
  -d '{
    "printer_id": "prt_abc123",
    "payload_type": "zpl",
    "payload_data": "^XA^FO50,50^A0N,40,40^FDHello from LabelInn^FS^XZ"
  }'

Replace prt_abc123 with the id from GET /v1/fleet/printers. The printer must be online and have cloud printing switched on in the app. Keys that start sk_test_ use a sandbox that never prints.

201 response (local stand-in for the API)RUN OUTPUT
{
  "data": {
    "id": "job_0001",
    "status": "queued",
    "priority": "normal",
    "printer_id": "prt_abc123",
    "printer_name": "Zebra ZD421 (packing bench)",
    "printer_status": "online",
    "payload_type": "zpl",
    "copies": 1,
    "total_labels": 1,
    "is_test": false,
    "created_at": "2026-11-16T18:03:16.784Z"
  }
}

same call again, same X-Idempotency-Key:
the same job comes back with "_idempotent": true
201 means queued, not printed

The label is rendered and sent by the PC that owns the printer, after the response. Poll GET /v1/print/jobs/{id} until the status is completed or failed. The stand-in API used here was written from functions/api/printJobs.js and docs/openapi.yaml; no request was sent to the live service and no job was created.

Video / 1:11LabelInn

Video: adding a Zebra to LabelInn, once, so the API can reach it (add a printer, 0:11). Shown on a GK420d, ZD421 and ZD220.

07 / TESTED

What was run for this page

Read this before you trust a picture.

RouteRun here?Result
Port 9100 from PowerShellRun against a local TCP listener49 bytes sent, the same 49 bytes received (SHA-256 identical).
Port 9100 from Python and Node.jsRun against the same listenerSame 49 bytes. A Python str in sendall raised TypeError: a bytes-like object is required, not 'str'.
An unreachable printerRuncreate_connection(("10.255.255.1", 9100), timeout=2) raised TimeoutError: timed out after 2.0 s. Always pass a timeout.
nc, copy /B, lp -o rawNot runnc is not installed on the test PC; the other two need a shared printer or CUPS. They follow Microsoft’s and CUPS’s documented behaviour.
API callRun against a local stand-incurl, and the official Python SDK 3.1.0 installed from PyPI, sent the shape shown above. Not run against the live service.
A physical ZebraNot usedNo printer was connected. Nothing on this page claims a label came out of a specific model.

08 / COST

What is free and what needs a plan

Routes 1 to 4 cost nothing. Only the API depends on your plan.

FREE

$0

  • Design and print labels by hand on Zebra, TSC, Toshiba and Epson printers, with no label limit
  • API sandbox: a sk_test_ key, read-only, 25 calls a day (it never prints)

STARTER

$7.99 / month

  • Everything in Free
  • Excel and CSV data binding, workflows, automations
  • API sandbox: 250 calls a day (still read-only)

PRO

$24.90 / month

  • Everything in Starter
  • The production API: sk_live_ keys that print, 2,000 calls a day, 60 a minute
  • Webhooks, watched folder, database sources
Download free

A signed-in Free user can start a 14-day trial by hand from the dashboard banner or the app’s paywall (no card): it unlocks Excel and CSV binding, bulk barcodes and the production API. It does not start by itself at signup. Yearly billing is ten months for twelve ($79.90 Starter, $249.00 Pro). All plans and limits: pricing.

QUESTIONS / FAQ

Frequently asked questions

How do I send a ZPL file to a Zebra printer?

Send the file as raw bytes. On the same network, write it to TCP port 9100: nc 192.168.1.50 9100 < label.zpl on Mac and Linux, or a PowerShell TcpClient on Windows. On Windows with a shared printer use copy /B label.zpl \\localhost\ZebraShare; with CUPS use lp -d Zebra_ZD421 -o raw label.zpl. From another network, post it to an API such as LabelInn’s.

Do I need a Zebra driver to print ZPL?

No. The printer interprets ZPL itself and only needs the bytes unchanged. A driver can even break raw ZPL by rendering it as a page, which prints the ZPL source as text.

What port does a Zebra printer use for ZPL?

TCP port 9100 for raw printing on network printers. A USB printer has no port: send through the Windows queue, CUPS, or an app that writes to USB, such as LabelInn.

Why does my ZPL print as text?

Something converted the file before it reached the printer: a driver, a normal print queue or a page-rendering step. Send it raw (port 9100, copy /B, lp -o raw). Also check that the printer is in ZPL mode and not another language.

Can I send ZPL from Windows without a Zebra driver?

Yes. Open a TCP connection to the printer’s port 9100 (the PowerShell snippet above) and write the file bytes unchanged. A driver is only needed if you want to print through the Windows print queue.

Can I send ZPL to a USB Zebra from another computer?

Not with port 9100, because a USB printer has none. Share the printer on the PC it is plugged into and use copy /B, or register it in LabelInn on that PC and post the ZPL to the API: the app writes it to the USB printer for you.

Does the API say when the label has printed?

It says what the job is doing. A 201 means queued; the job then moves through claimed, rendering and printing to completed or failed. A job for a printer that is off waits and prints when it is back.

Is there a trial for the API?

A signed-in Free user can start a 14-day trial by hand from the dashboard banner or the app’s paywall (no card): it unlocks Excel and CSV binding, bulk barcodes and the production API. It does not start by itself at signup.

NEXT STEP / LABELINN

Send your first ZPL label from anywhere

Download LabelInn, add the printer once, then call the API from any server. · Free plan, no card · Windows, Mac, Android · USB, network, Bluetooth

Download free →