ESC/POS command reference › ESC p
ESC p (1B 70): open the cash drawer from a receipt printer
The cash drawer plugs into the printer's drawer-kick (DK) port. ESC p tells the printer to send it a short pulse, which releases the drawer.
| ASCII | ESC p m t1 t2 |
| Hex | 1B 70 m t1 t2 |
| Decimal | 27 112 m t1 t2 |
Parameters
m | which pin: 0 = pin 2, 1 = pin 5. Libraries send either 0x00/0x01 or ASCII "0"/"1" (0x30/0x31); the viewer reads the lowest bit. |
t1 | pulse on time in units of 2 ms. |
t2 | pulse off time in units of 2 ms. |
What it does
Nothing prints. The printer just switches the drawer solenoid on for t1 × 2 ms. Try pin 2 first; if the drawer does not open, try pin 5.
Libraries pick different timings. Thermalink sends 1B 70 00 19 FA (50 ms on, 500 ms off). escpos-php's pulse() takes milliseconds, halves them, defaults to 120 ms on and 240 ms off (1B 70 30 3C 78). python-escpos uses 100 ms on and off (1B 70 00 32 32).
Because it goes through the printer, the drawer opens even from a web app, as long as the bytes reach the printer raw. The browser print dialog cannot send it.
Example
The viewer shows the drawer pulse as a marker on the receipt.
43 61 73 68 20 73 61 6C 65 20 31 32 2E 35 30 0A 1B 70 00 19 FA
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 |
|---|---|---|
| Text | "Cash sale 12.50" | 43 61 73 68 20 73 61 6C 65 20 31 32 2E 35 30 |
| ESC p | Open cash drawer: pin 2, pulse 50 ms on, 500 ms off | 1B 70 00 19 FA |
Sending it from code
JavaScript (bytes)
const openDrawer = [0x1b, 0x70, 0x00, 25, 250]; // pin 2, 50 ms on, 500 ms offPHP with escpos-php
$printer->pulse(); // pin 2, 120/240 ms: 1B 70 30 3C 78
$printer->pulse(1); // pin 5Python (raw bytes)
data += b"\x1b\x70\x00\x32\x32" # pin 2, 100 ms on, 100 ms off
Common mistakes
- Plugging the drawer into the network or phone socket. It goes into the printer's DK port, a phone-style (RJ11/RJ12) socket.
- Using pin 5 for a drawer wired to pin 2. If nothing happens, try the other pin.
- Expecting
window.print()to open it. Only raw printing can send these bytes.
Related commands
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).