ESC/POS command reference › GS !
GS ! (1D 21): double width and height text, up to 8x
One byte n sets both multipliers: the high four bits are width minus 1, the low four bits are height minus 1. 1D 21 11 is double width and double height.
| ASCII | GS ! n |
| Hex | 1D 21 n |
| Decimal | 29 33 n |
Parameters
n | (width - 1) × 16 + (height - 1), width and height 1 to 8. 0x00 normal, 0x01 double height, 0x10 double width, 0x11 both, 0x22 triple, 0x77 eight times. |
What it does
escpos-php's setTextSize($w, $h) computes 16 × (w - 1) + (h - 1) and checks each multiplier is 1 to 8. python-escpos builds the same byte from width values 0x00 to 0x70 and height values 0x00 to 0x07.
Wider text means fewer characters per line. Font A is 12 dots wide, so an 80 mm printer with 576 printable dots fits 48 characters at normal width, 24 at double width and 16 at triple width.
Thermalink uses GS ! for headings. The size stays in force until another GS !, ESC @ or ESC !.
Example
Double width and height, normal, then double height only.
1B 61 01 1D 21 11 43 41 46 45 0A 1D 21 00 6E 6F 72 6D 61 6C 20 73 69 7A 65 0A 1D 21 01 74 61 6C 6C 20 6F 6E 6C 79 0A 1D 21 00
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 a | Align center | 1B 61 01 |
| GS ! | Character size 2× wide, 2× high | 1D 21 11 |
| Text | "CAFE" | 43 41 46 45 |
| GS ! | Character size 1× wide, 1× high | 1D 21 00 |
| Text | "normal size" | 6E 6F 72 6D 61 6C 20 73 69 7A 65 |
| GS ! | Character size 1× wide, 2× high | 1D 21 01 |
| Text | "tall only" | 74 61 6C 6C 20 6F 6E 6C 79 |
| GS ! | Character size 1× wide, 1× high | 1D 21 00 |
Sending it from code
JavaScript (bytes)
const size = (w, h) => [0x1d, 0x21, ((w - 1) << 4) | (h - 1)];
size(2, 2); // [0x1d, 0x21, 0x11]PHP with escpos-php
$printer->setTextSize(2, 2); // 1D 21 11
$printer->setTextSize(1, 1); // 1D 21 00Python (raw bytes)
def size(w, h):
return bytes([0x1d, 0x21, ((w - 1) << 4) | (h - 1)])
Common mistakes
- Writing the multiplier in decimal.
GS ! 2is not double size: 0x02 means normal width and triple height. Double both is 0x11 (decimal 17). - Keeping the same column layout after enlarging text. Halve the characters per line at double width, or the line wraps.
- Forgetting to send
GS ! 0after the heading.
Related commands
ESC !: set font, bold, size and underline in one byteESC a: center or right-align text on a receipt printerESC E: bold text on a receipt printer
Sources
- escpos-php,
Printer.php(MIT licence) - python-escpos,
constants.py(MIT licence) - Thermalink agent output, printed on a BIXOLON SRP-352plusIII (Windows 11, USB)
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).