ESC/POS thermal printers: how they work and which one to buy
Every receipt printer you can buy speaks the same language, a command set Epson published in the 1990s called ESC/POS. Understanding roughly how it works turns "why is my receipt garbled" from a mystery into a two minute fix, and it tells you exactly which specification lines matter when you are choosing a printer.
What ESC/POS actually is
A receipt printer is not a page printer. It does not receive a rendered image of a page, it receives a
stream of bytes: text to print, interleaved with short escape sequences that change how the following
text behaves. The name comes from the escape character, 0x1B, that starts most of them.
ESC @ 1B 40 reset the printer
ESC a 1 1B 61 01 centre the following lines
ESC E 1 1B 45 01 bold on
GS ! 0x11 1D 21 11 double width and height
ESC d 4 1B 64 04 feed 4 lines
GS V 0 1D 56 00 cut the paper
That is the whole model. You send "reset, centre, double size, the shop name, normal size, left align, the item lines, feed, cut" and paper comes out. It is why receipt printing is fast and why it has survived thirty years unchanged: there is almost nothing to go wrong.
Why you get 32 or 48 characters per line
The print head is a row of heating elements, and the number of them is fixed. At 203 dpi, which is what nearly everything uses, that is 384 elements on a 58 mm printer and 576 on an 80 mm one.
The built in font, Font A, is a 12 dot wide character cell. 384 ÷ 12 = 32, and 576 ÷ 12 = 48. Switch to the condensed Font B at 9 dots and you get 42 and 64 columns instead, in noticeably smaller text. This is a hard physical limit, not a setting. If your line is 33 characters on a 58 mm printer, the 33rd wraps to the next line.
This is the single most useful number to know when you are formatting receipts programmatically. Build every line as a fixed width string, pad the middle with spaces so the price lands flush right, and your columns will line up on any printer of that width.
Choosing an interface
Pick this first, because it decides more than the brand does.
- USB. The default. Cheapest, most reliable, works with the vendor driver on Windows and usually appears as a generic printer on Linux. Downside: it is tethered to one machine.
- Ethernet or wifi. The right answer for a real till, a kitchen printer or anything more than one device prints to. The printer gets an IP address and you send bytes to port 9100. That is genuinely all there is to it, and it makes the printer trivially scriptable from anything.
- Bluetooth. Convenient for a phone or a market stall, fussy for anything else. Pairing drops, and Bluetooth printing from a browser is not a thing. Buy this only if mobile is the actual use case.
- Serial. Only if you are integrating with existing till hardware that expects it.
What to check before you buy
- Roll width. 80 mm for a shop or restaurant, 58 mm for a market stall, a taxi or anywhere space is tight. You cannot change your mind later without buying different paper.
- ESC/POS compatibility, stated explicitly. Almost everything supports it. The few that do not are a nightmare, so check the listing says so.
- Auto cutter. Worth the extra money the moment you print more than about twenty receipts a day. Tearing against a serrated edge gets old fast.
- Print speed. Anything from 200 mm/s up is fine. Below about 90 mm/s you will feel the wait at a busy counter.
- Drop-in paper loading. Cheap printers make you thread the roll. Good ones let you drop it in and close the lid. This matters more than any spec sheet number.
- Cash drawer port. An RJ11 socket labelled DK. If you will ever want a drawer, get it now, because the printer is what opens it.
Which printers are safe buys
- Epson TM-T20 series, 80 mm The default choice for a shop counter. Fast, an auto cutter, drop-in loading, and drivers that exist for every platform. More expensive than the no-name options and worth it if it is running all day. Check prices
- Star TSP100 / TSP143 series, 80 mm The other name you see behind counters. Comparable to the Epson, with unusually good support for printing from tablets and iPads if that is your setup. Check prices
- Generic 80 mm ESC/POS with Ethernet Xprinter, Rongta and similar sell 80 mm network printers for a fraction of the branded price. The print quality is the same, the plastics and the cutter are not. Fine for low volume, a false economy for a busy till. Check prices
- 58 mm portable Bluetooth Pocket sized, battery powered, for markets, deliveries and pop-ups. Expect 32 columns, no cutter and a fiddly pairing experience. Buy on battery life, not on brand. Check prices
These are search links, not endorsements of a specific listing. Check the seller and the roll width before you order.
Fixing the four problems everyone hits
The receipt prints as a wall of symbols
The printer is being sent something it does not understand, usually a raw PDF or a page image. Either install the vendor driver and print through it, or send it plain text and ESC/POS bytes. There is no middle ground.
Accented characters come out wrong
ESC/POS predates Unicode. The printer holds a set of single byte code pages and you select one with
ESC t n. For Czech, Polish or Hungarian you want code page 852 or Windows-1250, and you
must encode your text to match. Sending UTF-8 to a printer expecting 852 produces exactly the mojibake
you are looking at.
The paper comes out blank
Thermal paper only prints on one side. Nine times out of ten the roll is in upside down. Scratch the paper with a fingernail: the side that leaves a dark mark is the side that faces the head.
The print fades after a few months
That is thermal paper doing what thermal paper does, especially in heat or sunlight. It is a reason to keep a digital copy of anything that matters, and a reason receipts increasingly carry a QR code pointing at one.
Printing without writing any code
Free receipt generator with real thermal widths
Set the template to 58 mm or 80 mm and print straight from the browser at 1:1, or take the plain text export in true 32 or 48 column width and pipe it to the printer yourself. Barcodes, QR codes and the VAT summary are all generated offline.
Open the receipt generatorWritten by Oliver Žaigla, who builds software for a living. The generator is free, with no account and no upload. If it helped, buy me a coffee. If you need one of these built properly, write to oliver@zaigla.com.