1. Home
  2. Barcode & Generate
  3. ZPL, TSPL & EPL Generator

ZPL, TSPL & EPL Generator

Place text, barcodes, QR and boxes in mm and get ZPL, TSPL or EPL code.

Runs in your browser · No upload
mm
mm
e.g. E:KOREAN.TTF | a TTF stored on the printer. Without it, Korean or Chinese will not print.
Elements
mm
mm
mm
mm
mm
mm
mm
mm
mm
mm
mm
mm
Approximate preview

This is not a real printer render. Text size and barcode width differ slightly between printers, so confirm with a test print.

Generated code
^XA ^CI28 ^PW400 ^LL240 ^FO8,8^GB384,224,2^FS ^FO32,32^A0N,40,40^FDToolulah^FS ^FO32,96^BY1^BCN,96,Y,N,N^FDTOOLULAH-001^FS ^PQ1 ^XZ
Send the code through the printer driver in raw mode, over USB, or to network port 9100. This tool only builds the code and never sends it.

How to use

  1. Choose the output language. Check your printer manual to see whether it speaks ZPL, TSPL or EPL.
  2. Enter the label width and height (mm), the resolution (dpi) and the copies. The dpi must match the printer spec (203, 300 or 600) or positions and sizes will be off.
  3. In Manual, add elements (text, Code 128, EAN-13, QR, DataMatrix, box, line) and give their position (x, y) and size in mm. If you designed the label in Label Maker, switch to Label Maker JSON and paste the JSON.
  4. Copy the generated code, or save it as a .zpl, .prn or .txt file, and send it to the printer.

The three languages

Language Typical printers File extension (this tool)
ZPL II Zebra label printers and compatibles .zpl
TSPL TSC and other TSPL-compatible thermal printers .prn
EPL2 Older Zebra desktop printers .txt

The main commands:

Task ZPL TSPL EPL2
Label size ^PW ^LL (dots) SIZE (mm) q Q (dots)
Text ^A0 + ^FD TEXT / BLOCK A
Barcode ^BC, ^BE, … BARCODE B
QR ^BQ QRCODE b
Box, line ^GB BOX, BAR X, LO
Copies ^PQ PRINT n,1 Pn

dpi and dots

Printer coordinates are dots, not millimetres. The conversion is dots = round(mm × dpi ÷ 25.4).

  • 25.4 mm is 203 dots at 203 dpi, and 50 mm is 591 dots at 300 dpi
  • A 50×30 mm label is 400×240 dots at 203 dpi, and 100 mm is 1181 dots at 300 dpi
  • A 100×150 mm label is 799×1199 dots at 203 dpi

A 50×30 mm label at 203 dpi, 2 copies, with the text “Toolulah” and a Code 128 barcode comes out as:

^XA
^CI28
^PW400
^LL240
^FO32,32^A0N,40,40^FDToolulah^FS
^FO32,96^BY1^BCN,96,Y,N,N^FDTOOLULAH-001^FS
^PQ2
^XZ

The same label in TSPL is SIZE 50 mm,30 mm, GAP 2 mm,0, CLS, TEXT 32,32,"3",0,2,2,"Toolulah", BARCODE 32,96,"128",96,1,0,1,2,"TOOLULAH-001" and PRINT 2,1.

The bar width is the target width divided by the number of modules. With a narrow width and long data the module drops to 1 dot, which can be hard to scan on a 203 dpi printer, so widen the barcode or shorten the value. For EAN-13, EAN-8 and UPC-A the printer computes the check digit, so only the digits before it are sent.

Special characters and CJK text

  • In ZPL, ^ and ~ start commands and cannot appear literally. When the text has one, the tool turns on ^FH_ and writes ^ as _5E and ~ as _7E; _ becomes _5F at the same time.
  • TSPL and EPL wrap text in double quotes, so a " inside the text becomes \".
  • ZPL is set to ^CI28 (UTF-8), but the printer must already hold a font with Korean, Chinese or Japanese glyphs. Upload a TTF and enter its name, such as E:KOREAN.TTF, in the printer font box; only text with such characters then uses it through ^A@. TSPL works the same way with a printer font name, and this tool does not support CJK text in EPL2.
  • EPL2 has no DataMatrix, so those elements are skipped and the tool tells you. Image elements from Label Maker are not converted to commands either.

Sending and checking

This tool only builds the code; it never sends anything to a printer. You can send it three ways:

  1. Through the printer driver in raw mode
  2. Directly over USB
  3. To a network printer on port 9100

The preview is an approximation drawn from the design, not a real printer render. Text size, barcode width and the start position of rotated text differ a little between models, so print one test label first and check positions. For a PDF without printer code use Label Maker, for one barcode the Barcode Generator, for A4 label sheets the A4 Label Sheet Printer, and for GS1 formats the GS1 Barcode Builder.

The text you enter is processed only in your browser and is never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.