SGR 73 / 74 / 75 — Superscript / Subscript / Neither
Mintty's superscript / subscript SGR pair, now shipped by Kitty 0.32+, WezTerm, foot, and iTerm2. The first SGR attribute that lets terminal output typeset math, footnotes, and chemical formulae without trick characters.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[73m superscript \x1b[74m subscript \x1b[75m neither\033[73m / \033[74m / \033[75m\e[73m / \e[74m / \e[75mESC [ 73 m / ESC [ 74 m / ESC [ 75 m1b 5b 37 33 6d / 1b 5b 37 34 6d / 1b 5b 37 35 6dLive preview
Rendered in your browser via the same tokeniser the decoder uses — no terminal needed.
Description
Three SGR codes outside the historical ECMA-48 vocabulary (which stops at SGR 65) that mintty introduced ~2017 and that Kitty 0.32+, WezTerm 20240128+, foot 1.16+, iTerm2 3.5+ picked up afterwards. They are the *attribute* counterpart to the Unicode superscript / subscript blocks (U+2070–U+209F) — instead of substituting alternative glyphs, the terminal renders the current glyphs at smaller scale and raised / lowered baseline.
Codes
- \x1b[73m — superscript. Following characters render at ~75% size, baseline raised to roughly the cap-height line.
- \x1b[74m — subscript. Following characters render at ~75% size, baseline lowered.
- \x1b[75m — neither. Cancel both. Distinct from \x1b[0m (which also cancels every other attribute).
Why this matters
- *Math output* — write H₂O as H\x1b[74m2\x1b[75mO rather than H\u2082O (the latter only works if your output font has the subscript codepoints, many monospaced fonts don't).
- *Footnotes* — render text¹ from text\x1b[73m1\x1b[75m and remain searchable / copy-pasteable as plain digits.
- *Chemistry / units* — m², m³, kg·m·s⁻¹ all render in monospace without font-substitution gymnastics.
- *Diff output* — git --color-words and similar tools can use sub/super to mark insertion / deletion positions without disturbing the source line.
Constraints
- The attributes are mutually exclusive in spec: emitting \x1b[73m while subscript is active should toggle to superscript, not stack. Real emulators implement this correctly (last one wins).
- No nesting — there is no SGR for 'super-superscript'. Terminals fall back to single-level rendering.
- Copy / paste preserves the codepoints as written, not the rendered glyph — so H\x1b[74m2\x1b[75mO round-trips back to H2O (with the escape codes stripped by clipboard). This is *correct* for plain-text round-trips but means you can't rely on visual super/sub to communicate semantic super/sub to downstream tools that don't honour SGR — use Unicode for that.
- Width math — subscript / superscript characters still occupy 1 cell width on the grid; the smaller glyphs don't change column alignment. This is important for TUI layout: a labelled axis like 10² is still 3 cells wide.
Coverage: Kitty (≥ 0.32) + WezTerm (≥ 20240128) + foot (≥ 1.16) + iTerm2 (≥ 3.5) + mintty (≥ 3.4) = full. Ghostty = full (since 1.0). xterm = partial (patch #383+, only with cjkWidth: true; off otherwise). gnome-terminal + Konsole + Alacritty + Windows Terminal + cmd / ConPTY + macOS Terminal + Linux console = silently consumed (the SGR is parsed but the renderer paints normal-size baseline glyphs). Reset (\x1b[0m) cancels both attributes everywhere.
Spec citation: mintty / Kitty terminal-graphics-protocol superscript-extension / xterm-ctlseqs patch #383
Parameters
| 73 | Superscript on. |
| 74 | Subscript on. |
| 75 | Cancel super- and subscript (does not touch other SGR attributes). |
Examples
# Write 'H2O' with the 2 as subscript.\nprintf 'H\\033[74m2\\033[75mO\\n'\n# Cite 'foo^1' with footnote marker.\nprintf 'see foo\\033[73m1\\033[75m for context.\\n'import sys\nsys.stdout.write('Area: 10\\x1b[73m2\\x1b[75m m\\x1b[73m2\\x1b[75m\\n') # 10² m²// Render a sequence: x¹, x², x³ in monospace via SGR rather than Unicode.\nfor _, n := range []int{1, 2, 3} {\n fmt.Printf(\"x\\x1b[73m%d\\x1b[75m \", n)\n}\nfmt.Println()// Footnote marker that copy-pastes as plain digit.\nprocess.stdout.write('see ref' + '\\x1b[73m' + idx + '\\x1b[75m\\n');/* Chemical formula with subscripts. */\nprintf(\"C\\x1b[74m6\\x1b[75mH\\x1b[74m12\\x1b[75mO\\x1b[74m6\\x1b[75m\\n\");Terminal support
- xterm
- partial
- Linux console (fbcon)
- no
- macOS Terminal.app
- no
- iTerm2
- yes
- Windows Terminal
- no
- cmd.exe / ConPTY
- no
- kitty
- yes
- alacritty
- no
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- no
- Konsole
- no
- tmux
- yes
- 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| partial | no | no | yes | no | no | yes | no | yes | yes | no | no | yes | no |