Blog

What Is ESC/POS? How Receipt Printer Commands Work (With Examples)

24 October 2026 · 7 min read · By the Raw Print team

ESC/POS is a command language for receipt printers, created by Epson and copied by most thermal receipt printer makers. Instead of sending a finished page like an office printer, your software sends text mixed with short byte sequences, most of them starting with the ESC or GS control character, that tell the printer to switch on bold, centre a line, print a QR code or cut the paper. If your printer is a 58 mm or 80 mm receipt printer, it almost certainly understands ESC/POS.

Key facts:

  • Name: "ESC" is the escape character (byte 0x1B); "POS" means point of sale.
  • Who uses it: Epson TM printers and most receipt printers from other brands (Xprinter, HPRT, Rongta, Bixolon, Citizen and countless generic models).
  • What it does: text styles, character tables, images, barcodes, QR codes, paper cutting, cash drawer and status queries.
  • How you use it: through a library in your programming language, or through an app or driver that converts documents for you.

Why receipt printers need their own language

An office printer receives a whole page, already laid out, through a driver. A receipt printer works differently. It prints a continuous strip of paper line by line, it has a few built-in fonts, and it needs to do things office printers never do: cut the paper, kick open a cash drawer, report that the paper is running out.

ESC/POS gives software a simple way to do all of that. Plain text goes to the printer as it is, and commands are short byte sequences mixed in between. That keeps receipts small and fast. A full receipt is often only a few hundred bytes, which matters over a slow Bluetooth or serial link.

What an ESC/POS command looks like

Every command is a short sequence of bytes. Most begin with one of three control characters:

NameHexDecimalTypical use
ESC1B27Text formatting, printer setup, cash drawer
GS1D29Character size, barcodes, QR codes, images, cutting
DLE1016Real-time status requests

Here is a complete, tiny receipt written as bytes:

// ESC @            initialise the printer
1B 40
// ESC a 1          centre the following lines
1B 61 01
// ESC E 1          bold on
1B 45 01
"CORNER CAFE" 0A
// ESC E 0, ESC a 0 bold off, align left
1B 45 00  1B 61 00
"1 x Coffee      3.50" 0A
// ESC d 4          feed 4 lines
1B 64 04
// GS V 0           full cut
1D 56 00

The text itself is ordinary characters (0A is a line feed). The printer interprets each command and changes how the next text prints. Our ESC/POS command reference lists the commands you'll use most, with hex codes and examples.

What ESC/POS can do

Text formatting

Bold, underline, double width and height, inverted (white on black), and alignment left, centre or right. Most printers have two built-in fonts: Font A (12×24 dots) and the smaller Font B (9×17 dots).

Character tables (code pages)

The printer stores several alphabets, such as PC437 for English, PC850 or PC858 for Western Europe and PC866 for Cyrillic. Your software selects one with ESC t n, then sends text encoded in that table. Mismatched tables cause the classic "strange symbols" problem on receipts.

Images and logos

Pictures print as black-and-white dot patterns. The most common command is GS v 0, which sends a raster image line by line. Read how to print images and QR codes with ESC/POS.

Barcodes and QR codes

Many printers draw barcodes (GS k) and QR codes (GS ( k) themselves, which keeps them sharp and the data small.

Paper cutting and cash drawer

GS V cuts the paper on printers with a cutter. ESC p sends a pulse to the cash drawer port. See cutting paper and opening the cash drawer.

Status

Printers that can talk back answer status queries such as DLE EOT (paper, cover and error status) and GS I (model and manufacturer). Many cheap Bluetooth printers send nothing back, so don't rely on status alone.

ESC/POS vs other printer languages

ESC/POS isn't the only language thermal printers speak. Sending ESC/POS to a printer that expects something else prints garbage, or nothing.

LanguageUsed byNotes
ESC/POSEpson and most receipt printersThe de facto standard for receipts
Star Line Mode / StarPRNTStar Micronics receipt printersSimilar ideas, different bytes; many Star printers also offer an ESC/POS emulation mode
ZPLZebra label printersText-based label layout language
TSPL / TSPL2TSC and many budget label printersText-based, popular on 4×6 shipping label printers
CPCLMobile label and receipt printersCommon on rugged portable printers
Proprietary BLE protocolsMini "cat" and sticker printersOnly the maker's app (or a reverse-engineered one) can drive them

Is my printer ESC/POS compatible?

Check three things:

  1. The spec sheet or box. Look for "ESC/POS", "Epson compatible" or "ESC/POS command set".
  2. The self-test page. Hold Feed while switching the printer on. ESC/POS printers often list "Command: ESC/POS" or emulation settings.
  3. A test print. Send ESC @, a line of text and a line feed. If the text prints cleanly, the basics work.

Almost every 58 mm and 80 mm receipt printer sold for shops passes all three. Shipping label printers and mini sticker printers usually don't.

How to print with ESC/POS

You rarely write raw bytes by hand. Pick the route that fits your project:

From Python

The python-escpos library builds the commands and sends them over USB, serial or the network:

# pip install python-escpos
from escpos.printer import Network

p = Network("192.168.1.50")       # printer IP, port 9100
p.set(align="center", bold=True)
p.text("CORNER CAFE\n")
p.set(align="left", bold=False)
p.text("1 x Coffee      3.50\n")
p.qr("https://example.com/r/1042", size=6)
p.cut()

From JavaScript

The @point-of-sale/receipt-printer-encoder package (formerly esc-pos-encoder) turns a chain of calls into ESC/POS bytes in the browser or Node.js:

import ReceiptPrinterEncoder from '@point-of-sale/receipt-printer-encoder';

const encoder = new ReceiptPrinterEncoder({ language: 'esc-pos', columns: 32 });
const bytes = encoder
  .initialize()
  .align('center').bold(true).line('CORNER CAFE').bold(false)
  .align('left').line('1 x Coffee      3.50')
  .qrcode('https://example.com/r/1042')
  .cut()
  .encode();   // Uint8Array, ready to send

Our ESC/POS in JavaScript and Node.js guide covers sending those bytes to a printer, and ESC/POS in PHP, Java, C# and Flutter covers other languages.

From an Android phone, with no code

A print service app converts PDFs, web pages, pictures and text into ESC/POS for you. Raw Print, for example, prints from the Android Print menu and the share menu, and a web page can hand it raw ESC/POS bytes with a link:

// bytes = the Uint8Array from the encoder above
const base64 = btoa(String.fromCharCode(...bytes));
window.location.href = "rawbt:base64," + base64;

That link format is shared with RawBT, so existing web POS code works unchanged. We explain why web apps need this bridge in why your web POS needs a printing engine.

Common ESC/POS pitfalls

  • Forgetting to initialise. Start every job with ESC @, or styles from the last receipt carry over.
  • Assuming the paper width. 58 mm printers fit about 32 characters per line in Font A; 80 mm printers fit 42 or 48. ESC/POS has no command that reports the width.
  • Sending UTF-8 text. Printers don't understand UTF-8. Encode text in the selected code page, or print unsupported scripts as an image.
  • Assuming every command exists. Cheap clones skip some commands, especially newer graphics and QR commands. Test on the real printer.
  • Sending too fast. Big images can overflow a small printer buffer. Send in chunks or slow down.

Want to test without wasting paper? Try an ESC/POS emulator or virtual printer, and browse the best ESC/POS libraries on GitHub.

Frequently asked questions

What does ESC/POS stand for?

ESC refers to the escape control character that starts many commands, and POS stands for point of sale. Together, the name describes a command set for point-of-sale printers.

Is ESC/POS a standard?

It's Epson's proprietary command set, but so many manufacturers copy it that it works as a de facto standard for receipt printers. Clones support the core commands; advanced commands vary.

Do I need a driver to use ESC/POS?

No. ESC/POS commands go straight to the printer over USB, serial, Bluetooth or the network. A Windows driver is only needed when you want ordinary programs to print documents to the printer.

Can ESC/POS print in any language?

Only in the alphabets stored in the printer's character tables. For other scripts, software renders the text as an image and prints it as a picture.

Is ESC/POS the same as ZPL?

No. ZPL is Zebra's label printer language. It describes a whole label layout, while ESC/POS prints line by line. Label printers and receipt printers usually don't understand each other's language.