Guides › ZPL vs TSPL: what actually differs

ZPL vs TSPL: what actually differs

Published:

ZPL (Zebra) and TSPL (TSC and compatibles) solve the same problem — describe a label to a thermal printer — and look superficially alike: coordinates, fonts, barcodes, a print command. The differences that cost you an afternoon are not stylistic; they are in units, job structure and how each language names the same object.

The one difference that breaks ports: units

ZPL is dots, always. ^PW812 is 812 dots, which is 4 inches at 203 dpi and 2.7 inches at 300 dpi — the same file means a different physical size on a different printer.

TSPL takes real units at the top: SIZE 100 mm, 150 mm is millimetres, and an unitless SIZE 4, 6 means inches. Inside the label, coordinates are still dots. So a TSPL job declares its physical size and positions in dots, while a ZPL job expresses both in dots and leaves the physical size implicit in the media.

Porting a layout by copying coordinates therefore works only when both printers run the same density. Convert the geometry, not the numbers.

Side by side

ConceptZPLTSPL
Job boundaries^XA^XZ CLSPRINT 1
Label size^PW812, ^LL1218 (dots)SIZE 100 mm, 150 mm (real units)
Media gapPrinter-side setting GAP 3 mm, 0 mm in the job
Text^FO100,100^A0N,40,40^FDHELLO^FS TEXT 100, 100, "3", 0, 1, 1, "HELLO"
Barcode^BY3^FO100,200^BCN,100,Y,N,N^FD123456^FS BARCODE 100, 200, "128", 100, 1, 0, 3, 3, "123456"
QR code^FO100,400^BQN,2,6^FDQA,https://…^FS QRCODE 100, 400, M, 6, A, 0, "https://…"
Box / line^GB700,400,4^FS BOX 40, 40, 760, 400, 4 / BAR x, y, w, h
Copies^PQ3second argument of PRINT 1, 3

Two structural notes fall out of the table. TSPL commands are line-oriented with comma-separated arguments and quoted strings; ZPL is a caret-prefixed stream where a field ends at ^FS. And TSPL puts media handling (SIZE, GAP) inside the job, where ZPL mostly leaves it to the printer's configuration.

Three mistakes when porting

  1. Copying dot coordinates across densities. A layout built for 203 dpi lands at roughly two-thirds scale on a 300 dpi head. Recompute from millimetres, not from the old numbers.
  2. Forgetting that the field terminator disappears. ZPL's ^FS has no TSPL equivalent — a TSPL line is complete in itself. Porting the other way, a missing ^FS silently swallows the following commands into the previous field's data.
  3. Assuming barcode parameter order carries over. Both languages take height, human-readable flag, rotation and module widths, but in different positions, and the type is a quoted string in TSPL versus a distinct command in ZPL (^BC, ^BE, ^B3).

What our previews actually render

Both languages are rendered by separate engines here, and each has a documented scope. On the TSPL side, geometry and content commands draw — SIZE, GAP, CLS, TEXT, BARCODE, QRCODE, BOX, BAR, REFERENCE, PRINT — while printer-behaviour commands are recognised but deliberately not drawn: DIRECTION, OFFSET, BLINE, DENSITY, SPEED, SET and CODEPAGE change physical output a screen cannot reproduce. The TSPL barcode set covers Code 128, Code 39, EAN-13 and UPC-A.

Paste either language into its viewer to see this in practice: the ZPL viewer or the TSPL viewer. If you are not sure which language a file is written in, the language detector classifies it from the code itself.

Frequently asked questions

What is the main difference between ZPL and TSPL?

Units and job structure. ZPL expresses everything in dots (^PW812 is 812 dots), while TSPL declares the physical label in real units (SIZE 100 mm, 150 mm) and positions in dots. A ZPL job runs from ^XA to ^XZ; a TSPL job clears the buffer with CLS and commits it with PRINT.

Can I convert a ZPL label to TSPL by copying coordinates?

Only when both printers run the same resolution. Dot coordinates carry no physical size, so a 203 dpi layout lands at roughly two-thirds scale on a 300 dpi head. Recompute the geometry from millimetres instead.

Related guides

What is ZPL?

ZPL is the language Zebra thermal printers understand. How to read the commands, how a label is put together, and the most common mistakes.

Which barcode symbology should I use?

EAN-13, Code 128 or QR? Practical rules for picking a barcode based on your data, your space and the scanner that has to read it.

How to preview a ZPL file without a printer

A ZPL file is just text — the label only exists once something draws it. Three practical ways to see a ZPL label before it reaches the printer.

Try your own ZPL code →