Thermalink

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.

ASCIIESC - n
Hex1B 2D n
Decimal27 45 n

Parameters

n0 = 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
CommandWhat it doesBytes
ESC -Underline 1 dot1B 2D 01
Text"Thin underline"54 68 69 6E 20 75 6E 64 65 72 6C 69 6E 65
ESC -Underline 2 dot1B 2D 02
Text"Thick underline"54 68 69 63 6B 20 75 6E 64 65 72 6C 69 6E 65
ESC -Underline off1B 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 2

PHP with escpos-php

$printer->setUnderline(Printer::UNDERLINE_SINGLE); // 1B 2D 01
$printer->setUnderline(Printer::UNDERLINE_NONE);   // 1B 2D 00

Python (raw bytes)

data = b"\x1b\x2d\x01" + b"Thin underline\n" + b"\x1b\x2d\x00"

Common mistakes

Related commands

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).