Skip to main content
ansicode

DECTCEM ?25 — Show/hide cursor

Show or hide the text cursor.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[?25h (show) \x1b[?25l (hide)
\\033[\033[?25h / \033[?25l
\\e[\e[?25h / \e[?25l
ESC [ESC [ ? 2 5 h / l
hex1b 5b 3f 32 35 68 / 6c

Description

DEC Text Cursor Enable Mode. Useful for progress bars and TUIs to avoid the blinking caret on top of redrawn text. Always restore (`?25h`) on exit, including in panic / signal handlers — a stuck `?25l` will hide the user's prompt cursor until the next `tput cnorm` / terminal reset.

Spec citation: xterm-ctlseqs (DECTCEM)

Examples

bash
printf '\033[?25l'; sleep 2; printf '\033[?25h'
python
import sys; sys.stdout.write('\x1b[?25l')
go
fmt.Print("\x1b[?25l")
javascript
process.stdout.write('\x1b[?25l')
c
printf("\x1b[?25l");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
yes
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences

In the family cookbook

DEC cookbook · 1. The `?` prefix — DECSET vs SM