The printer commands you actually need for receipts and labels, with their bytes. Type in the box to filter.
used means my own agent, Thermalink, sends exactly these bytes and its tests check them. Its receipts print correctly on a BIXOLON SRP-352plusIII, but I have not checked every row on paper one by one. reference means standard Epson ESC/POS that my agent does not send. Cheaper printers skip some commands, so test on yours.
Paper widths
Paper
Resolution
Printable dots
Columns, font A
Columns, font B
80 mm
203 dpi (8 dots/mm)
576 (72 mm)
48
64
80 mm
180 dpi
512
42
56
58 mm
203 dpi
384 (48 mm)
32
42
These are nominal. My "576 dot" printer measured 568 usable dots, so print a ruler before trusting the spec sheet.
ESC/POS (receipt printers)
ESC is byte 1B, GS is 1D, DLE is 10. n is one byte you choose. Bytes are in hex.
Basics
Command
Bytes (hex)
What it does
ESC @
1B 40
Initialise the printer. Clears formatting set by earlier jobs. Send it first.
used
LF
0A
Print the line buffer and feed one line.
used
ESC d n
1B 64 n
Print and feed n lines.
used
ESC 2
1B 32
Default line spacing.
reference
ESC 3 n
1B 33 n
Line spacing of n dots.
reference
Text style
Command
Bytes (hex)
What it does
ESC a n
1B 61 n
Align: 0 left, 1 centre, 2 right.
used
ESC E n
1B 45 n
Bold: 1 on, 0 off.
used
ESC - n
1B 2D n
Underline: 0 off, 1 thin, 2 thick.
used
GS B n
1D 42 n
White on black: 1 on, 0 off.
used
GS ! n
1D 21 n
Character size. High 4 bits = width multiplier minus 1, low 4 bits = height multiplier minus 1. 00 normal, 11 double both, 10 double width, 01 double height.
used
ESC M n
1B 4D n
Font: 0 = A (12x24), 1 = B (9x17, more columns).
reference
ESC ! n
1B 21 n
Older combined mode byte: bit 0 font B, bit 3 bold, bit 4 double height, bit 5 double width, bit 7 underline.
reference
Characters
Command
Bytes (hex)
What it does
ESC t n
1B 74 n
Select the code page. Epson numbering: 0 CP437, 2 CP850, 16 Windows-1252, 17 CP866, 19 CP858 (has the euro sign). Other brands number them differently, so check the self-test page.
used
ESC R n
1B 52 n
International character set (changes a few ASCII symbols). 0 = USA.
reference
Cut and cash drawer
Command
Bytes (hex)
What it does
GS V 0
1D 56 00
Full cut at the current position. Feed a few lines first or you cut through the last line.
used
GS V 1
1D 56 01
Partial cut.
used
GS V 65 n
1D 56 41 n
Feed to the cutter plus n extra steps, then full cut. Use n = 0 if unsure.
reference
GS V 66 n
1D 56 42 n
Feed to the cutter plus n extra steps, then partial cut.
reference
ESC p 0 t1 t2
1B 70 00 19 FA
Kick the cash drawer on pin 2. t1 and t2 are the pulse on and off times in 2 ms units.
used
ESC p 1 t1 t2
1B 70 01 19 FA
Kick the cash drawer on pin 5.
used
QR code (GS ( k)
Command
Bytes (hex)
What it does
Model
1D 28 6B 04 00 31 41 32 00
Select QR model 2.
used
Module size
1D 28 6B 03 00 31 43 n
Dot size of one module, n = 1 to 16.
used
Error correction
1D 28 6B 03 00 31 45 n
n = 48 L, 49 M, 50 Q, 51 H.
used
Store data
1D 28 6B pL pH 31 50 30 d1...dk
pL + pH x 256 = k + 3, where k is the number of data bytes.
Start the data with 7B 42 ("{B") to select code set B.
used
EAN-13
1D 6B 43 n d1...dn
n = 12 or 13 digits.
used
EAN-8
1D 6B 44 n d1...dn
n = 7 or 8 digits.
used
UPC-A
1D 6B 41 n d1...dn
n = 11 or 12 digits.
used
CODE39
1D 6B 45 n d1...dn
Digits, capitals and a few symbols.
used
Images
Command
Bytes (hex)
What it does
GS v 0
1D 76 30 00 xL xH yL yH d1...dk
Raster image. xL + xH x 256 = width in bytes (dots / 8). yL + yH x 256 = height in dots. One bit per dot, 1 = black, most significant bit on the left. Send tall images in bands.
used
Status
Command
Bytes (hex)
What it does
DLE EOT n
10 04 n
Real-time status: 1 printer, 2 offline cause, 3 error cause, 4 paper sensor. The printer answers with one byte, so you need a two-way connection.
reference
GS r 1
1D 72 01
Paper sensor status.
reference
A whole receipt in bytes
const ESC = 0x1b, GS = 0x1d;
const text = s => [...new TextEncoder().encode(s)]; // ASCII only; see the code page row above
const bytes = new Uint8Array([
ESC, 0x40, // initialise
ESC, 0x61, 1, // centre
GS, 0x21, 0x11, // double width and height
...text('BLUE DOOR CAFE\n'),
GS, 0x21, 0x00, // normal size
ESC, 0x61, 0, // left
...text('Flat white x2 8.00\n'),
ESC, 0x45, 1, // bold on
...text('TOTAL 8.00\n'),
ESC, 0x45, 0, // bold off
ESC, 0x64, 3, // feed 3 lines so the cut clears the text
GS, 0x56, 0x00 // full cut
]);
Getting those bytes from a web page to the printer is the hard part. Thermalink does that, and builds the bytes from JSON so you do not write this by hand.
ZPL (Zebra label printers)
Plain text commands. Positions are in dots: 203 dpi is 8 dots per mm. I have not printed these on a Zebra; they follow Zebra's programming guide.
Command
What it does
^XA ... ^XZ
Start and end of a label. Everything goes between them.
^PW n
Label width in dots.
^LL n
Label length in dots.
^LH x,y
Label home: moves the origin for every field.
^FO x,y
Field origin: where the next field goes, in dots from the top left.
^FD text ^FS
Field data, then field separator. Every field ends with ^FS.
^CF0,h
Default font 0 at height h dots.
^A0N,h,w
Font 0, normal rotation, height h and width w, for the next field.
^FB w,lines,,align
Field block: wrap text to width w. Align is L, C, R or J.
^BY w,r,h
Barcode defaults: module width, wide to narrow ratio, height.
^BCN,h,Y,N,N
Code 128 barcode, height h, with the text printed below.
^BQN,2,m
QR code, model 2, magnification m. The data starts with a prefix: ^FDQA,your-data^FS.
^GB w,h,t
Box or line: width, height, line thickness.
^FR
Reverse the next field (white on black where it overlaps).
^CI28
Read field data as UTF-8.
^PQ n
Print n copies.
^XA
^CF0,40
^FO40,40^FDShip to: Jane Doe^FS
^CF0,30
^FO40,90^FD221B Baker Street, London^FS
^FO40,150^BY3^BCN,120,Y,N,N^FD1Z999AA10123456784^FS
^FO40,320^BQN,2,6^FDQA,https://example.com/track/1Z999AA10123456784^FS
^XZ
TSPL (TSC, 4BARCODE, Xprinter label printers)
One command per line, each line ending with CR LF. I have not printed these on a label printer; they follow the TSPL manual.
Command
What it does
SIZE 50 mm, 30 mm
Label width and height.
GAP 2 mm, 0 mm
Gap between labels and its offset.
DIRECTION 1
Print direction, 0 or 1.
CLS
Clear the image buffer. Send it before drawing each label.
TEXT x,y,"font",rot,xmul,ymul,"content"
Text at x,y in dots. Fonts "1" to "8" are built in; rot is 0, 90, 180 or 270.
QR code. ECC is L, M, Q or H; cell is the module size 1 to 10; mode A is automatic.
BAR x,y,w,h
Filled bar or line.
BOX x,y,xend,yend,thickness
Rectangle outline.
DENSITY n
Darkness, 0 to 15.
SPEED n
Print speed in inches per second.
PRINT sets,copies
Print the label. Always the last line.
SIZE 50 mm, 30 mm
GAP 2 mm, 0 mm
DIRECTION 1
CLS
TEXT 20,20,"3",0,1,1,"Organic Honey 500g"
TEXT 20,60,"2",0,1,1,"Price: 9.99"
BARCODE 20,100,"128",70,1,0,2,2,"SKU-000123"
PRINT 1,1
Last checked 11 October 2026. Found a mistake? Tell me through the Gumroad page.