Thermalink

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.

CommandHexWhat it does
ESC @1B 40initialize the printer
ESC E1B 45 nbold text on a receipt printer
ESC -1B 2D nunderline text on a receipt printer
GS !1D 21 ndouble width and height text, up to 8x
ESC !1B 21 nset font, bold, size and underline in one byte
ESC a1B 61 ncenter or right-align text on a receipt printer
ESC d1B 64 nprint and feed paper
ESC 31B 33 nreceipt line spacing
GS B1D 42 nwhite on black (reverse) text
ESC t1B 74 nselect the code page for accents and the euro sign
GS V1D 56 m [n]cut the paper (full or partial)
ESC p1B 70 m t1 t2open the cash drawer from a receipt printer
GS k1D 6B m n d1...dnprint EAN-13, UPC-A, CODE39 and CODE128 barcodes
GS ( k1D 28 6B pL pH 31 fn ...print a QR code on a receipt printer
GS v 01D 76 30 m xL xH yL yH d1...dkprint 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.