Skip to content

Clipboard access (OSC 52)

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

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).

Supported by 6 of 6 backends (100%)

Support Matrix

BackendVersionSupportNotes
Alacritty0.26.0✓ yes
Ghostty1.3.1✓ yes
Kitty0.40.0✓ yes
vt1000.1.0✓ yes
WezTerm0.1.0-fork.5✓ yes
xterm.js5.5.0✓ yes

Powered by Termless
Playwright for Terminals