OSC 8
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
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
| Parameter | Description | Default |
|---|---|---|
params | Key-value pairs separated by colons (e.g., id=foo) | (empty) |
uri | The 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
idparameter ensures that wrapped links remain a single hover/click target
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
| Specification | Section |
|---|---|
| Hyperlinks in Terminals | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | Hyperlinks - set_hyperlink in term/mod.rs:1874 |
| Bobcat | ✓ | 0.9.0 | WhenLink callback and Hyperlinks() enabled from initial release |
| contour | ✓ | v0.1.0 | Hyperlinks with optional parameters |
| foot | ✓ | Yes | Hyperlinks with id parameter, osc.c:1377-1379, 479-536 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | Hyperlinks with full id and url support |
| Konsole | ✓ | Yes | Hyperlinks handled via URL_LINK in src/Vt102Emulation.cpp:654-656, urlExtractor in src/Vt102Emulation.cpp:1147-1154 |
| mintty | ✓ | Yes | Implemented at termout.c:4873-4881, hyperlinks (clickable links) |
| mlterm | ✗ | No | |
| PuTTY | ✗ | No | Not implemented in do_osc function |
| Rio | ✓ | v0.0.28 | Supports id parameter for linking related hyperlinks |
| rxvt-unicode | ✗ | No | |
| st | ✗ | No | |
| terminology | ✓ | v1.3.0 | |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | OSC 8 (VTEHYPER) handled in vteseq.cc for hyperlinks |
| WezTerm | ✓ | Yes | OSC 8 SetHyperlink - see wezterm-escape-parser/src/osc.rs:39,316,468 |
| Windows Terminal | ✓ | Yes | Hyperlink case via AddHyperlink/EndHyperlink with _ParseHyperlink |
| xterm | ✗ | No | No evidence in documentation or source code |
| xterm.js | ✓ | 5.0.0 | |
| Multiplexers | |||
| cy | ✗ | No | |
| GNU Screen | ✗ | No | |
| tmux | ✓ | 3.4 | Hyperlinks support |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.21.0 | |
See also
- OSC 0 — Set Icon Name and Window Title — Another common OSC sequence