ESC/POS command reference: the commands receipts actually use
The 15 commands that cover almost every receipt: styles, alignment, size, code pages, feed and cut, cash drawer, barcodes, QR codes and logos. Each page has the bytes, a live preview you can open in the ESC/POS viewer, code for JavaScript, PHP and Python, and the mistakes I see most.
| Command | Hex | What it does |
|---|---|---|
ESC @ | 1B 40 | initialize the printer |
ESC E | 1B 45 n | bold text on a receipt printer |
ESC - | 1B 2D n | underline text on a receipt printer |
GS ! | 1D 21 n | double width and height text, up to 8x |
ESC ! | 1B 21 n | set font, bold, size and underline in one byte |
ESC a | 1B 61 n | center or right-align text on a receipt printer |
ESC d | 1B 64 n | print and feed paper |
ESC 3 | 1B 33 n | receipt line spacing |
GS B | 1D 42 n | white on black (reverse) text |
ESC t | 1B 74 n | select the code page for accents and the euro sign |
GS V | 1D 56 m [n] | cut the paper (full or partial) |
ESC p | 1B 70 m t1 t2 | open the cash drawer from a receipt printer |
GS k | 1D 6B m n d1...dn | print EAN-13, UPC-A, CODE39 and CODE128 barcodes |
GS ( k | 1D 28 6B pL pH 31 fn ... | print a QR code on a receipt printer |
GS v 0 | 1D 76 30 m xL xH yL yH d1...dk | print a logo or image on a receipt printer |
A receipt in these commands
A typical job: ESC @ to reset, ESC t for the code page, ESC a 1 and GS ! for a centered heading, plain text lines ending in LF, ESC E for the total, a QR code with GS ( k, then ESC d 3 and GS V to feed and cut. Paste your own bytes into the viewer to see each one decoded.
Where this comes from
ESC/POS is Epson's command language; many other receipt printer brands follow it, with differences in the details. These pages are written in my own words from two widely used open-source libraries, escpos-php and python-escpos, from what Thermalink sends to a real BIXOLON SRP-352plusIII, and from the viewer's interpreter, which every example on these pages is checked against when the site is built. Epson's own reference is here. For the full list on one page, see the ESC/POS, ZPL and TSPL cheat sheet.
Rather not build bytes by hand? Thermalink prints receipts and labels from a web app with no print dialog: JSON in, paper out ($49 one-time).
Last checked 22 November 2026.