OSC 50 — Set or query font (xterm font selector)
Switch the terminal's display font at runtime, or query the current font — xterm extension, also implemented by a handful of forks.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b]50;FONT-SPEC\x07 (set) \x1b]50;?\x07 (query)\033]50;FONT-SPEC\007\e]50;FONT-SPEC\aESC ] 50 ; FONT-SPEC BEL1b 5d 35 30 3b ... 07Description
OSC 50 switches the terminal's display font at runtime. The argument is a font specification understood by the terminal — historically an XLFD (`-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1`), modern xterm and forks also accept Xft / fontconfig names (`monospace:size=14`, `Iberian Black:size=12:weight=bold`). A leading `+N`/`-N` instead of a name shifts the size up/down by N pixels relative to current. Sending `?` (`\x1b]50;?\x07`) makes the terminal reply with the current font name as `\x1b]50;NAME\x07` — used by `vim`'s `:set guifont` autodetect equivalent and by `xterm`'s font menu. urxvt added a parallel OSC 710 / 711 / 712 for its own font/boldFont/italicFont slots. Modern non-xterm terminals (kitty, alacritty, wezterm, ghostty, Windows Terminal, iTerm2) all manage fonts via their own config — they don't honour OSC 50 because there's no single 'default font' to override.
Spec citation: xterm-ctlseqs (OSC 50)
Examples
printf '\033]50;monospace:size=18\007' # bump to 18pt monospace\nprintf '\033]50;?\007' # query current font nameimport sys; sys.stdout.write('\x1b]50;monospace:size=18\x07')fmt.Print("\x1b]50;monospace:size=18\x07")process.stdout.write('\x1b]50;monospace:size=18\x07')printf("\x1b]50;monospace:size=18\x07");Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- no
- iTerm2
- no
- Windows Terminal
- no
- cmd.exe / ConPTY
- no
- kitty
- no
- alacritty
- no
- WezTerm
- no
- Ghostty
- no
- GNOME Terminal
- no
- Konsole
- no
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | no | no | no | no | no | no | no | no | no | no | no | no | no |