ESC/POS command reference › ESC -
ESC - (1B 2D): underline text on a receipt printer
1B 2D 01 gives a thin (1-dot) underline, 1B 2D 02 a thick (2-dot) one, 1B 2D 00 turns it off.
| ASCII | ESC - n |
| Hex | 1B 2D n |
| Decimal | 27 45 n |
Parameters
n | 0 = off, 1 = 1-dot line, 2 = 2-dot line. The viewer also accepts the ASCII digits 0x30 to 0x32. |
What it does
The line is drawn under each character, and it stays on until ESC - 0, ESC @, or an ESC ! byte without bit 7.
python-escpos labels the two values "Underline font 1-dot ON" and "2-dot ON". escpos-php has UNDERLINE_NONE, UNDERLINE_SINGLE and UNDERLINE_DOUBLE for 0, 1 and 2. "Double" there means the thicker line, not two lines.
Example
n = 1, then n = 2, then off.
1B 2D 01 54 68 69 6E 20 75 6E 64 65 72 6C 69 6E 65 0A 1B 2D 02 54 68 69 63 6B 20 75 6E 64 65 72 6C 69 6E 65 0A 1B 2D 00 4E 6F 20 75 6E 64 65 72 6C 69 6E 65 0A
Preview drawn in your browser by the ESC/POS viewer's engine on 80 mm paper. Letters use a similar monospace font, not the printer's own. Open this example in the viewer to edit the bytes.
How the viewer decodes these bytes
| Command | What it does | Bytes |
|---|---|---|
| ESC - | Underline 1 dot | 1B 2D 01 |
| Text | "Thin underline" | 54 68 69 6E 20 75 6E 64 65 72 6C 69 6E 65 |
| ESC - | Underline 2 dot | 1B 2D 02 |
| Text | "Thick underline" | 54 68 69 63 6B 20 75 6E 64 65 72 6C 69 6E 65 |
| ESC - | Underline off | 1B 2D 00 |
| Text | "No underline" | 4E 6F 20 75 6E 64 65 72 6C 69 6E 65 |
Sending it from code
JavaScript (bytes)
const underline = (n) => [0x1b, 0x2d, n]; // 0, 1 or 2PHP with escpos-php
$printer->setUnderline(Printer::UNDERLINE_SINGLE); // 1B 2D 01
$printer->setUnderline(Printer::UNDERLINE_NONE); // 1B 2D 00Python (raw bytes)
data = b"\x1b\x2d\x01" + b"Thin underline\n" + b"\x1b\x2d\x00"
Common mistakes
- Reading "double underline" as two lines. Value 2 is one thicker line.
- Leaving underline on before padding spaces for a two-column row, so the gap between name and price gets underlined as well.
Related commands
ESC E: bold text on a receipt printerESC !: set font, bold, size and underline in one byteGS B: white on black (reverse) text
Sources
I wrote this page from the open-source libraries above, Thermalink's own output and tests on my BIXOLON printer. It is not copied from Epson's manual. For model-specific details see Epson's official ESC/POS reference or your printer maker's manual. Last checked 22 November 2026.
Building receipts byte by byte? Thermalink lets a web app send the receipt as JSON and prints it silently, with QR codes, logos, cut and cash drawer ($49 one-time).