Skip to content

Clipboard access (OSC 52)

Category: extensions · Baseline: modern · Tags: Operating System Commands (OSC), Xterm Extensions · Specification ↗

ESC ] 52 ; c ; base64 BEL
OSC 52 allows terminal applications to read from and write to the system clipboard. To set the clipboard: ESC ] 52 ; c ; <base64-data> ST. To query it: ESC ] 52 ; c ; ? ST, and the terminal responds with the base64-encoded clipboard contents. This is particularly valuable for remote sessions (SSH, tmux, mosh) where the application has no direct access to the local system clipboard. A vim session inside tmux over SSH can yank text to the user's local clipboard without any special tooling. Security is a concern: clipboard read access lets any application running in the terminal silently exfiltrate clipboard contents. Many terminals disable read access by default or prompt the user for confirmation, while still allowing clipboard writes. The c parameter selects the clipboard buffer — c for clipboard, p for primary selection (X11).
How this is testedautomated
Set clipboard via OSC 52 ; c ; <base64> BEL, then query with OSC 52 ; c ; ? BEL and verify response contains the data. Confirms read/write clipboard support.

The same probe runs against headless backends (via Termless) and real terminal apps (via a daemon launched in each terminal). This lets us distinguish parser correctness from rendering correctness.

Analysis2026-04-06

Supported by 10 of 12 terminals (83%). Not supported by: vt100.js, xterm.js. Part of the Modern TUI baseline. Notes: vt100.js: Not implemented — pure TypeScript emulator; xterm.js: OSC 52 clipboard not implemented in xterm.js.

Supported by 9 of 14 backends (64%)

Terminal Applications

TerminalVersionSupportNotes
iTerm23.6.9✓ yes
Ghostty1.3.1✓ yes
VS Code✓ yes
Warp✓ yes
Cursor✓ yes
Terminal.app✓ yes

Headless Backends

Parser correctness only — a means the parser accepts the sequence.

BackendVersionSupportNotes
vterm0.2.0✓ yes
Alacritty0.26.0~ partialOSC 52 clipboard not exposed in headless mode
Kitty0.40.0~ partialOSC 52 clipboard not exposed via Python batch bridge
WezTerm0.1.0-fork.5~ partialOSC 52 clipboard not exposed in headless mode
vt100.js0.2.1✗ noNot implemented — pure TypeScript emulator
xterm.js5.5.0✗ noOSC 52 clipboard not implemented in xterm.js