ROUTE 1 / MAC, LINUX, GIT BASH
nc to port 9100
nc 192.168.1.50 9100 < label.zplcat label.zpl > /dev/tcp/192.168.1.50/9100DEVELOPERS / ZPL / UPDATED 16 NOV 2026
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.
^XA^FO50,50^A0N,40,40^FDHello from LabelInn^FS^XZnc 192.168.1.50 9100 < label.zplOn 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.
01 / DECISION
Find your situation in the left column.
| You are sending from | Use | Why |
|---|---|---|
| A PC, Mac or Linux box on the printer’s network | Route 1, port 9100 | Shortest path: one command, no software, no driver. |
| A Windows PC where the Zebra is installed (USB or network) | Route 2, copy /B to the share | Uses the queue Windows already has; binary mode keeps the bytes. |
| A Mac or Linux PC with the printer in CUPS | Route 3, lp -o raw | Skips the CUPS filters that would turn ZPL into a page. |
| A script or service you are writing | Route 4, a socket in your language | Same as route 1, from code. Set a timeout. |
| A cloud server, another site, or a USB printer on a PC you cannot reach | Route 5, the LabelInn API | Only one that works across networks and also gives you a job status. |
02 / DIRECT
Raw bytes, no driver. The PowerShell snippet was run; the others follow documented behaviour.
ROUTE 1 / MAC, LINUX, GIT BASH
nc 192.168.1.50 9100 < label.zplcat label.zpl > /dev/tcp/192.168.1.50/9100ROUTE 1 / WINDOWS
$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()ROUTE 2 / WINDOWS SHARE
copy /B label.zpl \\localhost\ZebraShareROUTE 3 / CUPS
lp -d Zebra_ZD421 -o raw label.zpl03 / CODE
Python and Node.js, both run against a listener that stands in for port 9100.
Open the file in binary mode and send the bytes.
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)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 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... identicalThe 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
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.
^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
^XZPaste 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.
05 / TROUBLESHOOT
Most failures come from something touching the bytes on the way.
| What you see | Usual cause | What to do |
|---|---|---|
| The ZPL itself prints as text | A 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 happens | The 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 ignored | Three 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 wrong | The 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 position | The 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:
Out-File -Encoding utf8: starts with ef bb bf.pwsh) with the same command: starts with 5e 58 41, no BOM.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.
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 0a06 / API
One HTTPS call, a queue, a job status.
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.400 PRINTER_LANGUAGE_MISMATCH instead of printing junk.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.
{
"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": trueThe 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: 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
Read this before you trust a picture.
| Route | Run here? | Result |
|---|---|---|
| Port 9100 from PowerShell | Run against a local TCP listener | 49 bytes sent, the same 49 bytes received (SHA-256 identical). |
| Port 9100 from Python and Node.js | Run against the same listener | Same 49 bytes. A Python str in sendall raised TypeError: a bytes-like object is required, not 'str'. |
| An unreachable printer | Run | create_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 raw | Not run | nc 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 call | Run against a local stand-in | curl, and the official Python SDK 3.1.0 installed from PyPI, sent the shape shown above. Not run against the live service. |
| A physical Zebra | Not used | No printer was connected. Nothing on this page claims a label came out of a specific model. |
08 / COST
Routes 1 to 4 cost nothing. Only the API depends on your plan.
FREE
$0
sk_test_ key, read-only, 25 calls a day (it never prints)STARTER
$7.99 / month
PRO
$24.90 / month
sk_live_ keys that print, 2,000 calls a day, 60 a minuteA 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
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.
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.
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.
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.
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.
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.
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.
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.
KEEP GOING
NEXT STEP / LABELINN
Download LabelInn, add the printer once, then call the API from any server. · Free plan, no card · Windows, Mac, Android · USB, network, Bluetooth