Skip to main content

OSC 8

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Experimental

OSC 8 embeds clickable hyperlinks in terminal output, allowing text to link to URIs in much the same way HTML anchor tags work on the web.

Syntax​

OSC 8 ; params ; uri ST   Start hyperlink
OSC 8 ; ; ST End hyperlink
Formal syntax
OSC8_start = 0x1b, "]", "8", ";", params, ";", uri, ( 0x07 | 0x1b, "\\" ) ;
OSC8_end   = 0x1b, "]", "8", ";", ";", ( 0x07 | 0x1b, "\\" ) ;
params     = [ param, { ":", param } ] ;
param      = key, "=", value ;
key        = character, { character } ;
value      = character, { character } ;
uri        = character, { character } ;

Parameters​

ParameterDescriptionDefault
paramsKey-value pairs separated by colons (e.g., id=foo)(empty)
uriThe target URI (e.g., https://example.com)(required to start, empty to end)

The id parameter is the most commonly used. When multiple non-adjacent runs of text share the same id value, they are treated as a single logical hyperlink. This allows a long link to be split across wrapped lines and still highlight as one unit when hovered.

Description​

Per the "Hyperlinks in Terminals" specification, OSC 8 creates inline hyperlinks in terminal output. The sequence works in pairs: an opening sequence specifies the URI and begins the hyperlinked region, and a closing sequence (with empty params and URI) ends it. All text emitted between the two sequences becomes clickable.

The hyperlink model is designed to be backward-compatible. Terminals that do not support OSC 8 simply display the text without the link, since the OSC sequences themselves produce no visible output.

Key design points:

  • URI schemes — Any URI scheme is valid (https:, http:, file:, mailto:, ssh:, etc.)
  • Hover behavior — Most terminals underline the link text and show the URI in a tooltip or status bar on hover
  • Click behavior — Clicking typically opens the URI in the system's default handler
  • Nesting — Hyperlinks cannot be nested; opening a new link implicitly closes any active one
  • Line wrapping — The id parameter ensures that wrapped links remain a single hover/click target
note

The params field uses colons as delimiters between key-value pairs, not semicolons, to avoid ambiguity with the OSC parameter separator.

Examples​

# Simple hyperlink
printf '\e]8;;https://example.com\e\\Click here\e]8;;\e\\'

# Hyperlink with id parameter for line-wrapping support
printf '\e]8;id=mylink;https://example.com\e\\This is a long link that may wrap\e]8;;\e\\'

# mailto link
printf '\e]8;;mailto:user@example.com\e\\Email us\e]8;;\e\\'

# File link
printf '\e]8;;file:///home/user/document.pdf\e\\Open document\e]8;;\e\\'

# Using BEL as terminator
printf '\e]8;;https://example.com\aLink text\e]8;;\a'

Specifications​

SpecificationSection
Hyperlinks in Terminals—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesHyperlinks - set_hyperlink in term/mod.rs:1874
Bobcat✓0.9.0WhenLink callback and Hyperlinks() enabled from initial release
contour✓v0.1.0Hyperlinks with optional parameters
foot✓YesHyperlinks with id parameter, osc.c:1377-1379, 479-536
Ghostty✓v1.0.0
iTerm2✓v20260216-nightly
Kitty✓YesHyperlinks with full id and url support
Konsole✓YesHyperlinks handled via URL_LINK in src/Vt102Emulation.cpp:654-656, urlExtractor in src/Vt102Emulation.cpp:1147-1154
mintty✓YesImplemented at termout.c:4873-4881, hyperlinks (clickable links)
mlterm✗No
PuTTY✗NoNot implemented in do_osc function
Rio✓v0.0.28Supports id parameter for linking related hyperlinks
rxvt-unicode✗No
st✗No
terminology✓v1.3.0
VT100✗No
VTE✓YesOSC 8 (VTEHYPER) handled in vteseq.cc for hyperlinks
WezTerm✓YesOSC 8 SetHyperlink - see wezterm-escape-parser/src/osc.rs:39,316,468
Windows Terminal✓YesHyperlink case via AddHyperlink/EndHyperlink with _ParseHyperlink
xterm✗NoNo evidence in documentation or source code
xterm.js✓5.0.0
Multiplexers
cy✗No
GNU Screen✗No
tmux✓3.4Hyperlinks support
tuios✓v0.0.15
Zellij✓v0.21.0

See also​