# Terminal control sequences

> A reference for terminal control sequences, with every example run live in libghostty-vt.

A terminal takes one stream of bytes. Most of it is text to put on the
screen, and the rest are *control sequences*: instructions to move the
cursor, erase part of the screen, change colors, set the window title,
and much else. This site documents a handful of them.

Each page states what a sequence does and then gives **validation cases**: a
sequence of input and the screen it should leave behind. Those cases are not
pictures. When you open a page your browser loads
[libghostty-vt](https://github.com/ghostty-org/ghostty), the terminal emulation
core of Ghostty, compiled to WebAssembly, feeds every case into a real
terminal, and shows what came out next to what was expected. You can step
through a case one line of input at a time and watch the cursor move.

The tally in the last column is computed as this page loads, by running every
case on every page. The [notation](https://control-codes.page/notation/index.html.md) page explains how cases are
written.

## C0 control characters

- [BS: Backspace](https://control-codes.page/c0/bs/index.html.md): Move the cursor one column to the left.
- [BEL: Bell](https://control-codes.page/c0/bel/index.html.md): Ring the terminal's bell.
- [CAN: Cancel](https://control-codes.page/c0/can/index.html.md): Abandon the escape sequence, control sequence or control string in progress.
- [CR: Carriage Return](https://control-codes.page/c0/cr/index.html.md): Move the cursor to the left margin of the current line.
- [DC1: Device Control One](https://control-codes.page/c0/dc1/index.html.md): XON and XOFF: flow control for what the terminal sends, with no effect on the screen.
- [ENQ: Enquiry](https://control-codes.page/c0/enq/index.html.md): Ask the terminal to send its answerback message.
- [ESC: Escape](https://control-codes.page/c0/esc/index.html.md): Begin an escape sequence, abandoning any sequence already in progress.
- [FF: Form Feed](https://control-codes.page/c0/ff/index.html.md): Move the cursor down one line, exactly as a line feed does.
- [HT: Horizontal Tab](https://control-codes.page/c0/ht/index.html.md): Move the cursor right to the next tab stop.
- [LF: Line Feed](https://control-codes.page/c0/lf/index.html.md): Move the cursor down one line, scrolling at the bottom margin.
- [NUL: Null](https://control-codes.page/c0/nul/index.html.md): A byte that carries nothing and is ignored.
- [SO: Shift Out](https://control-codes.page/c0/so/index.html.md): Switch the characters printed to the G1 set, and back to G0.
- [SUB: Substitute](https://control-codes.page/c0/sub/index.html.md): Display an error character in place of something that could not be received, abandoning any sequence in progress.
- [VT: Vertical Tab](https://control-codes.page/c0/vt/index.html.md): Move the cursor down one line, exactly as a line feed does.

## Escape sequences

- [DECBI: Back Index](https://control-codes.page/esc/decbi/index.html.md): Move the cursor one column, scrolling the region sideways at the margin.
- [CSI: Control Sequence Introducer](https://control-codes.page/esc/csi/index.html.md): Begin a control sequence: parameters, intermediates and a final byte.
- [DCS: Device Control String](https://control-codes.page/esc/dcs/index.html.md): Open a control string carrying commands for the terminal itself.
- [HTS: Horizontal Tabulation Set](https://control-codes.page/esc/hts/index.html.md): Set a tab stop at the cursor's column.
- [DECKPAM: Keypad Application Mode](https://control-codes.page/esc/deckpam/index.html.md): Choose what the numeric keypad sends: its digits or application codes.
- [DECDWL: Double-Width Line](https://control-codes.page/esc/decdwl/index.html.md): Make the cursor's line double-width or double-height, or put it back to single-width.
- [LS2: Locking Shift Two](https://control-codes.page/esc/ls2/index.html.md): Switch the characters printed to the G2 or G3 set.
- [NEL: Next Line](https://control-codes.page/esc/nel/index.html.md): Move the cursor to the start of the next line, scrolling at the bottom margin.
- [RIS: Reset to Initial State](https://control-codes.page/esc/ris/index.html.md): Reset the terminal to the state it has when switched on.
- [RI: Reverse Index](https://control-codes.page/esc/ri/index.html.md): Move the cursor up one line, scrolling down at the top margin.
- [DECSC: Save Cursor](https://control-codes.page/esc/decsc/index.html.md): Save the cursor and its attributes, and later put them back.
- [DECALN: Screen Alignment Test](https://control-codes.page/esc/decaln/index.html.md): Fill the screen with the letter E.
- [SS2: Single Shift Two](https://control-codes.page/esc/ss2/index.html.md): Print the next character from the G2 or G3 set.
- [SPA: Start of Guarded Area](https://control-codes.page/esc/spa/index.html.md): Mark the characters written in between as protected from erasure.
- [SOS: Start of String](https://control-codes.page/esc/sos/index.html.md): Open a control string whose content the terminal itself does not act on.
- [ST: String Terminator](https://control-codes.page/esc/st/index.html.md): End a control string, such as an operating system command or a device control string.

## Control sequences

- [DECCARA: Change Attributes in Rectangular Area](https://control-codes.page/csi/deccara/index.html.md): Change or reverse the rendition of a rectangle of the screen without rewriting its characters.
- [HPA: Character Position Absolute](https://control-codes.page/csi/hpa/index.html.md): Move the cursor to column n of the line it is on.
- [HPB: Character Position Backward](https://control-codes.page/csi/hpb/index.html.md): Move the cursor left n columns.
- [HPR: Character Position Forward](https://control-codes.page/csi/hpr/index.html.md): Move the cursor right n columns.
- [DECCRA: Copy Rectangular Area](https://control-codes.page/csi/deccra/index.html.md): Copy a rectangle of the screen, characters and attributes, to another place.
- [CUB: Cursor Backward](https://control-codes.page/csi/cub/index.html.md): Move the cursor left n columns.
- [CBT: Cursor Backward Tabulation](https://control-codes.page/csi/cbt/index.html.md): Move the cursor back to the previous tab stop, n times.
- [CHA: Cursor Character Absolute](https://control-codes.page/csi/cha/index.html.md): Move the cursor to column n of the line it is on.
- [CUD: Cursor Down](https://control-codes.page/csi/cud/index.html.md): Move the cursor down n lines.
- [CUF: Cursor Forward](https://control-codes.page/csi/cuf/index.html.md): Move the cursor right n columns.
- [CHT: Cursor Horizontal Tabulation](https://control-codes.page/csi/cht/index.html.md): Move the cursor forward n tab stops.
- [CNL: Cursor Next Line](https://control-codes.page/csi/cnl/index.html.md): Move the cursor down n lines, to the start of the line.
- [CUP: Cursor Position](https://control-codes.page/csi/cup/index.html.md): Move the cursor to a given line and column.
- [CPL: Cursor Preceding Line](https://control-codes.page/csi/cpl/index.html.md): Move the cursor up n lines, to the start of the line.
- [CTC: Cursor Tabulation Control](https://control-codes.page/csi/ctc/index.html.md): Set or clear tab stops: at the cursor, or all of them.
- [CUU: Cursor Up](https://control-codes.page/csi/cuu/index.html.md): Move the cursor up n lines.
- [DECDSR: DEC Device Status Reports](https://control-codes.page/csi/decdsr/index.html.md): DEC's private status requests: the extended cursor position, the printer, the keyboard, macro space and the like.
- [DECRST: DEC Private Mode Reset](https://control-codes.page/csi/decrst/index.html.md): Turn one or more DEC private modes off.
- [DECSET: DEC Private Mode Set](https://control-codes.page/csi/decset/index.html.md): Turn one or more DEC private modes on.
- [DCH: Delete Character](https://control-codes.page/csi/dch/index.html.md): Delete n characters at the cursor, pulling the rest of the line left.
- [DL: Delete Line](https://control-codes.page/csi/dl/index.html.md): Delete n lines at the cursor, pulling the lines below it up.
- [DA: Device Attributes](https://control-codes.page/csi/da/index.html.md): Ask the terminal what kind of terminal it is.
- [DSR: Device Status Report](https://control-codes.page/csi/dsr/index.html.md): Ask the terminal for its status or for the cursor position, and get a report back.
- [ECH: Erase Character](https://control-codes.page/csi/ech/index.html.md): Blank n characters from the cursor rightwards, without moving anything.
- [ED: Erase in Display](https://control-codes.page/csi/ed/index.html.md): Erase part or all of the screen.
- [EL: Erase in Line](https://control-codes.page/csi/el/index.html.md): Erase part or all of the cursor's line.
- [DECERA: Erase Rectangular Area](https://control-codes.page/csi/decera/index.html.md): Erase every character in a rectangle of the screen.
- [DECFRA: Fill Rectangular Area](https://control-codes.page/csi/decfra/index.html.md): Fill a rectangle of the screen with one character, in the current rendition.
- [HVP: Horizontal and Vertical Position](https://control-codes.page/csi/hvp/index.html.md): Move the cursor to a given line and column, as CUP does.
- [DECIC: Insert Column](https://control-codes.page/csi/decic/index.html.md): Insert or delete whole columns at the cursor, shifting the rest of the scrolling region sideways.
- [ICH: Insert Character](https://control-codes.page/csi/ich/index.html.md): Insert n blank cells at the cursor, shifting the rest of the line right.
- [IL: Insert Line](https://control-codes.page/csi/il/index.html.md): Insert n blank lines at the cursor, pushing the lines below it down.
- [DECTST: Invoke Confidence Test](https://control-codes.page/csi/dectst/index.html.md): Run the terminal's own self-tests, after which nothing about its state can be relied on.
- [XTMODKEYS: Set Key Modifier Options](https://control-codes.page/csi/xtmodkeys/index.html.md): Choose how keys pressed with Shift, Control or Alt are sent, and ask what is chosen.
- [CSI = u: Set Flags](https://control-codes.page/csi/kitty-keyboard/index.html.md): Ask the terminal to report keys unambiguously, with every modifier and with releases, through a stack of flags.
- [VPA: Line Position Absolute](https://control-codes.page/csi/vpa/index.html.md): Move the cursor to line n, keeping its column.
- [VPB: Line Position Backward](https://control-codes.page/csi/vpb/index.html.md): Move the cursor up n lines, keeping its column.
- [VPR: Line Position Forward](https://control-codes.page/csi/vpr/index.html.md): Move the cursor down n lines, keeping its column.
- [DECELR: Enable Locator Reports](https://control-codes.page/csi/decelr/index.html.md): Report the position of a mouse or tablet, the locator, to the host.
- [MC: Media Copy](https://control-codes.page/csi/mc/index.html.md): Print the screen, or send what the host sends to a printer instead of the screen.
- [NP: Next Page](https://control-codes.page/csi/np/index.html.md): Move to another page of display memory, on terminals that have more than one.
- [REP: Repeat](https://control-codes.page/csi/rep/index.html.md): Print the character before it n more times.
- [XTVERSION: Report Version](https://control-codes.page/csi/xtversion/index.html.md): Ask the terminal for its name and version.
- [DECRQCRA: Request Checksum of Rectangular Area](https://control-codes.page/csi/decrqcra/index.html.md): Ask for a checksum of part of the screen, to check it has not changed.
- [DECRQM: Request Mode](https://control-codes.page/csi/decrqm/index.html.md): Ask the terminal whether a mode is set, and get a DECRPM report back.
- [DECRQPSR: Request Presentation State Report](https://control-codes.page/csi/decrqpsr/index.html.md): Ask for the cursor's state or the tab stops, as a report that can be sent back later to restore them.
- [RM: Reset Mode](https://control-codes.page/csi/rm/index.html.md): Turn one or more ANSI modes off.
- [XTRESTORE: Restore DEC Private Mode Values](https://control-codes.page/csi/xtrestore/index.html.md): Put back private modes saved with XTSAVE.
- [XTSAVE: Save DEC Private Mode Values](https://control-codes.page/csi/xtsave/index.html.md): Remember the state of some private modes, to put back later.
- [SD: Scroll Down](https://control-codes.page/csi/sd/index.html.md): Move the contents of the scrolling region down n lines.
- [SL: Scroll Left](https://control-codes.page/csi/sl/index.html.md): Move the contents of the scrolling region left or right by n columns.
- [SU: Scroll Up](https://control-codes.page/csi/su/index.html.md): Move the contents of the scrolling region up n lines.
- [DECSR: Secure Reset](https://control-codes.page/csi/decsr/index.html.md): Reset the terminal to its power-up state, erase everything the host could have stored in it, and confirm that it was done.
- [DECSCL: Select Conformance Level](https://control-codes.page/csi/decscl/index.html.md): Make the terminal behave as an earlier level of DEC terminal, with a soft reset.
- [SGR: Select Graphic Rendition](https://control-codes.page/csi/sgr/index.html.md): Set the colors and attributes of the characters written after it.
- [SIMD: Select Implicit Movement Direction](https://control-codes.page/csi/simd/index.html.md): ECMA-48's choice of which way text runs, which xterm takes as Scroll Down.
- [DECSNLS: Select Number of Lines per Screen](https://control-codes.page/csi/decsnls/index.html.md): Choose how many lines the screen shows at once.
- [DECSCA: Select Character Protection Attribute](https://control-codes.page/csi/decsca/index.html.md): Protect characters from erasure, then erase everything else on the line or the screen.
- [DECSCPP: Set Columns Per Page](https://control-codes.page/csi/decscpp/index.html.md): Make the page 80 or 132 columns wide, without clearing it.
- [DECSCUSR: Set Cursor Style](https://control-codes.page/csi/decscusr/index.html.md): Choose the cursor's shape, and whether it blinks.
- [DECSLRM: Set Left and Right Margins](https://control-codes.page/csi/decslrm/index.html.md): Set the columns of the scrolling region, once left and right margins are enabled.
- [SM: Set Mode](https://control-codes.page/csi/sm/index.html.md): Turn one or more ANSI modes on.
- [DECSTBM: Set Top and Bottom Margins](https://control-codes.page/csi/decstbm/index.html.md): Set the lines of the scrolling region.
- [DECSTR: Soft Terminal Reset](https://control-codes.page/csi/decstr/index.html.md): Put the modes and settings a program may have changed back to their defaults, leaving the screen alone.
- [DECSASD: Select Active Status Display](https://control-codes.page/csi/decsasd/index.html.md): Show a status line below the screen, and send text to it instead of the screen.
- [TBC: Tabulation Clear](https://control-codes.page/csi/tbc/index.html.md): Clear the tab stop at the cursor, or every tab stop.
- [DECRQTSR: Request Terminal State Report](https://control-codes.page/csi/decrqtsr/index.html.md): Ask for most of the terminal's settable state in one compact report, and send it back later to restore it.
- [XTWINOPS: Window Operations](https://control-codes.page/csi/xtwinops/index.html.md): Move, resize and raise the window, report its size and state, and save and restore its title.

## ANSI modes

- [BDSM: Bi-directional Support Mode](https://control-codes.page/ansi/bdsm/index.html.md): Whether the terminal or the host handles bidirectional text.
- [HEM: Character Editing Mode](https://control-codes.page/ansi/hem/index.html.md): Which way characters move when one is inserted or deleted.
- [CRM: Control Representation Mode](https://control-codes.page/ansi/crm/index.html.md): Show control characters as graphic symbols instead of performing them.
- [DCSM: Device Component Select Mode](https://control-codes.page/ansi/dcsm/index.html.md): Whether editing functions act on the presentation or the data.
- [EBM: Editing Boundary Mode](https://control-codes.page/ansi/ebm/index.html.md): A mode ECMA-48 has removed.
- [ERM: Erasure Mode](https://control-codes.page/ansi/erm/index.html.md): Whether erasing touches protected areas.
- [FEAM: Format Effector Action Mode](https://control-codes.page/ansi/feam/index.html.md): Whether formatting functions are performed or only stored.
- [FETM: Format Effector Transfer Mode](https://control-codes.page/ansi/fetm/index.html.md): Whether formatting functions may be added to what is transmitted.
- [GRCM: Graphic Rendition Combination Mode](https://control-codes.page/ansi/grcm/index.html.md): Whether each SGR replaces the rendition or adds to it.
- [GATM: Guarded Area Transfer Mode](https://control-codes.page/ansi/gatm/index.html.md): Whether guarded areas are left out when the screen is sent to the host.
- [IRM: Insertion Replacement Mode](https://control-codes.page/ansi/irm/index.html.md): Insert characters instead of writing over them.
- [KAM: Keyboard Action Mode](https://control-codes.page/ansi/kam/index.html.md): Lock and unlock the keyboard.
- [VEM: Line Editing Mode](https://control-codes.page/ansi/vem/index.html.md): Which way lines move when one is inserted or deleted.
- [LNM: Line Feed/New Line Mode](https://control-codes.page/ansi/lnm/index.html.md): Make a line feed return to the first column as well.
- [MATM: Multiple Area Transfer Mode](https://control-codes.page/ansi/matm/index.html.md): Whether one selected area or all of them is transmitted.
- [PUM: Positioning Unit Mode](https://control-codes.page/ansi/pum/index.html.md): Whether cursor movement counts in characters or in SSU units.
- [SATM: Selected Area Transfer Mode](https://control-codes.page/ansi/satm/index.html.md): Whether only selected areas are transmitted.
- [SRM: Send/Receive Mode](https://control-codes.page/ansi/srm/index.html.md): Turn local echo off and on.
- [SRTM: Status Report Transfer Mode](https://control-codes.page/ansi/srtm/index.html.md): Whether a status report goes with every transmission.
- [TSM: Tabulation Stop Mode](https://control-codes.page/ansi/tsm/index.html.md): Whether a tab stop applies to every line or only one.
- [TTM: Transfer Termination Mode](https://control-codes.page/ansi/ttm/index.html.md): Whether a transmission stops at the cursor.
- [ZDM: Zero Default Mode](https://control-codes.page/ansi/zdm/index.html.md): Whether a parameter of 0 means zero or the default.

## Private modes

- [?1049: Alternate Screen](https://control-codes.page/modes/altscreen/index.html.md): Switch to a second screen for full-screen programs, and back to the one the shell was using.
- [DECARM: Autorepeat Mode](https://control-codes.page/modes/decarm/index.html.md): Turn the repeating of held-down keys on and off.
- [DECAWM: Autowrap Mode](https://control-codes.page/modes/decawm/index.html.md): Choose whether text reaching the right margin continues on the next line.
- [?2004: Bracketed Paste](https://control-codes.page/modes/paste/index.html.md): Mark pasted text, so that a program can tell it from typing.
- [DECCOLM: Column Mode](https://control-codes.page/modes/deccolm/index.html.md): Switch the screen between 80 and 132 columns, clearing it.
- [?12: Cursor Blink](https://control-codes.page/modes/blink/index.html.md): Start or stop the cursor blinking.
- [DECHCCM: Horizontal Cursor Coupling Mode](https://control-codes.page/modes/dechccm/index.html.md): Choose whether the window follows the cursor around a page larger than the screen.
- [DECCKM: Cursor Keys Mode](https://control-codes.page/modes/decckm/index.html.md): Choose what the arrow keys send: cursor movement or application codes.
- [?1004: Focus Events](https://control-codes.page/modes/focus/index.html.md): Have the terminal tell the program when its window gains or loses the keyboard focus.
- [DECKBUM: Keyboard Usage Mode](https://control-codes.page/modes/deckbum/index.html.md): Choose between typewriter keys and data processing keys.
- [XTLOGGING: Start Logging](https://control-codes.page/modes/logging/index.html.md): Start or stop logging the session to a file, in an xterm built to log; DECGPBM on a VT340.
- [?1000: Mouse Tracking](https://control-codes.page/modes/mouse/index.html.md): Ask the terminal to report mouse buttons and movement, and choose how the reports are encoded.
- [DECNRCM: National Replacement Character Set Mode](https://control-codes.page/modes/decnrcm/index.html.md): Allow the 7-bit national character sets, which replace a few ASCII characters with letters of one language.
- [DECNCSM: No Clearing Screen On Column Change](https://control-codes.page/modes/decncsm/index.html.md): Keep DECCOLM from clearing the screen, on a VT510; a default xterm ignores it.
- [DECOM: Origin Mode](https://control-codes.page/modes/decom/index.html.md): Count cursor positions from the margins instead of the corner of the screen.
- [DECPEX: Print Extent Mode](https://control-codes.page/modes/decpex/index.html.md): Choose what a print operation sends to the printer, and whether it ends with a form feed.
- [DECSCNM: Screen Mode](https://control-codes.page/modes/decscnm/index.html.md): Show the whole screen in reverse video: dark text on a light background.
- [DECSCLM: Scrolling Mode](https://control-codes.page/modes/decsclm/index.html.md): Choose between jump scrolling and smooth, slow scrolling.
- [DECSDM: Sixel Display Mode](https://control-codes.page/modes/decsdm/index.html.md): Choose whether a sixel image scrolls with the text from the cursor, or is drawn from the top left corner.
- [?2026: Synchronized Output](https://control-codes.page/modes/sync/index.html.md): Hold back drawing the screen until a program has finished updating it.
- [DECTCEM: Text Cursor Enable Mode](https://control-codes.page/modes/dectcem/index.html.md): Show or hide the cursor.

## Device control strings

- [DECDLD: Down Line Load](https://control-codes.page/dcs/decdld/index.html.md): Load the glyphs of a soft character set, which can then be designated like any other.
- [ReGIS: Remote Graphic Instruction Set](https://control-codes.page/dcs/regis/index.html.md): Enter DEC's vector graphics language, whose commands draw lines, curves and text until ST.
- [XTGETXRES: Request Resource Values](https://control-codes.page/dcs/xtgetxres/index.html.md): Ask xterm for the value of one of its X resources.
- [DECRQSS: Request Selection or Setting](https://control-codes.page/dcs/decrqss/index.html.md): Ask for the current setting of a function, as the sequence that would set it.
- [XTGETTCAP: Request Termcap/Terminfo String](https://control-codes.page/dcs/xtgettcap/index.html.md): Ask the terminal what a key sends, or for one of a few of its capabilities, by its terminfo or termcap name.
- [XTSETTCAP: Set Termcap Data](https://control-codes.page/dcs/xtsettcap/index.html.md): Tell xterm which terminal description to take its function keys from.
- [Sixel: Sixel Graphics](https://control-codes.page/dcs/sixel/index.html.md): Draw a bitmap image in the text, six pixels high at a time, from a device control string.
- [DECUDK: User Defined Keys](https://control-codes.page/dcs/decudk/index.html.md): Load the strings the function keys send, and optionally lock them against being loaded again.
- [DECAUPSS: Assign User-Preference Supplemental Set](https://control-codes.page/dcs/decaupss/index.html.md): Choose which supplemental character set is the user's preferred one, or ask which it is.

## Operating system commands

- [OSC 9999: Agent Status](https://control-codes.page/osc/agent-status/index.html.md): Report a coding agent's state to Orca, which shows it on a dashboard of every agent it runs.
- [OSC 776: Report Cell Size](https://control-codes.page/osc/cell-size/index.html.md): Ask rxvt-unicode for the size of a character cell and its font's ascent, in pixels.
- [OSC 4: Change Color Palette](https://control-codes.page/osc/palette/index.html.md): Set and query the colors that SGR's color numbers stand for.
- [OSC 46: Change Log File](https://control-codes.page/osc/logfile/index.html.md): Tell xterm which file to log its session to, in a build that can log.
- [OSC 52: Manipulate Selection Data](https://control-codes.page/osc/clipboard/index.html.md): Let a program set or read the clipboard, even over ssh.
- [OSC 9 ; 11: Comment](https://control-codes.page/osc/conemu-comment/index.html.md): A comment, to be skipped.
- [OSC 3008: Hierarchical Context Signalling](https://control-codes.page/osc/context/index.html.md): Tell the terminal when a shell, a command, a container or a privileged session starts and ends.
- [OSC 9: Desktop Notification](https://control-codes.page/osc/notify/index.html.md): Ask the terminal to show a desktop notification.
- [OSC 72: Drag and Drop](https://control-codes.page/osc/dnd/index.html.md): Let a program in the terminal accept dropped files and text, and start drags of its own: kitty's drag and drop protocol.
- [OSC 9 ; 8: Environment Variable](https://control-codes.page/osc/conemu-env/index.html.md): Write out an environment variable.
- [OSC 555: Flash Screen](https://control-codes.page/osc/flash/index.html.md): Flash the whole terminal briefly, foot's extension.
- [OSC 7777: Set Font and Window Size](https://control-codes.page/osc/font-window-size/index.html.md): Set mintty's font size and resize its window with it, keeping its rows and columns.
- [OSC 7770: Set Font Size](https://control-codes.page/osc/font-size/index.html.md): Set mintty's font size, or change it by steps, without resizing the window.
- [OSC 17: Highlight Background Color](https://control-codes.page/osc/highlight-background/index.html.md): Set and query the color of the background of selected text.
- [OSC 19: Highlight Foreground Color](https://control-codes.page/osc/highlight-foreground/index.html.md): Set and query the color of selected text.
- [OSC 8: Hyperlink](https://control-codes.page/osc/hyperlink/index.html.md): Make text a link, the way an anchor does in HTML.
- [OSC 1337: iTerm2 Extensions](https://control-codes.page/osc/iterm2/index.html.md): iTerm2's own commands: inline images, marks, user variables, the clipboard and the working directory, and its other OSC extensions.
- [OSC 5522: Clipboard by MIME Type](https://control-codes.page/osc/kitty-clipboard/index.html.md): Read and write the clipboard by MIME type, with permission and status: kitty's clipboard protocol.
- [OSC 21: Kitty Colors, or DECSWT](https://control-codes.page/osc/kitty-color/index.html.md): Two meanings for one number: kitty's protocol for querying and setting colors, and DEC's VT520 Set Window Title, which xterm follows.
- [OSC 99: Desktop Notifications](https://control-codes.page/osc/kitty-notify/index.html.md): Show desktop notifications with titles, icons, buttons and updates: kitty's notification protocol.
- [OSC 701: Set Locale](https://control-codes.page/osc/locale/index.html.md): Set the locale rxvt-unicode reads its input in, or ask for it.
- [OSC 9 ; 2: Message Box](https://control-codes.page/osc/conemu-message/index.html.md): Show a message box.
- [OSC 440: Play Sound](https://control-codes.page/osc/sound/index.html.md): Play a sound file, mintty's extension.
- [OSC 14: Pointer Background Color](https://control-codes.page/osc/pointer-background/index.html.md): Set and query the color of the mouse pointer's outline.
- [OSC 13: Pointer Foreground Color](https://control-codes.page/osc/pointer-foreground/index.html.md): Set and query the color of the mouse pointer, while it is over the window.
- [OSC 22: Change Pointer Shape](https://control-codes.page/osc/pointer/index.html.md): Change the shape of the mouse pointer while it is over the terminal.
- [OSC 30101: Pop Colors](https://control-codes.page/osc/pop-colors/index.html.md): Restore the colors from kitty's stack.
- [OSC 9 ; 4: Progress Report](https://control-codes.page/osc/progress/index.html.md): Show a program's progress in the tab and the taskbar.
- [OSC 9 ; 12: Prompt Start](https://control-codes.page/osc/conemu-prompt/index.html.md): Mark where the shell's prompt starts, the ConEmu way.
- [OSC 30001: Push Colors](https://control-codes.page/osc/push-colors/index.html.md): Save the colors on kitty's stack.
- [OSC 62: Query Allowable Features](https://control-codes.page/osc/allowable/index.html.md): Ask xterm what all the parts of one of its guarded features are.
- [OSC 60: Query Allowed Features](https://control-codes.page/osc/allowed/index.html.md): Ask xterm which of its optional, security-sensitive features are allowed.
- [OSC 61: Query Disallowed Features](https://control-codes.page/osc/disallowed/index.html.md): Ask xterm which parts of one of its guarded features are refused while that feature is off.
- [OSC 51: Reserved for Emacs](https://control-codes.page/osc/emacs/index.html.md): A number xterm sets aside for the Emacs shell, and does nothing with itself.
- [OSC 104: Reset Color Palette](https://control-codes.page/osc/reset-palette/index.html.md): Put palette colors back as they started.
- [OSC 117: Reset Highlight Background Color](https://control-codes.page/osc/reset-highlight-background/index.html.md): Put the highlight background color back as it started.
- [OSC 119: Reset Highlight Foreground Color](https://control-codes.page/osc/reset-highlight-foreground/index.html.md): Put the highlight foreground color back as it started.
- [OSC R: Reset Palette (Linux)](https://control-codes.page/osc/linux-reset-palette/index.html.md): Put the palette back, as the Linux console does.
- [OSC 114: Reset Pointer Background Color](https://control-codes.page/osc/reset-pointer-background/index.html.md): Put the pointer background color back as it started.
- [OSC 113: Reset Pointer Foreground Color](https://control-codes.page/osc/reset-pointer-foreground/index.html.md): Put the pointer foreground color back as it started.
- [OSC 105: Reset Special Color](https://control-codes.page/osc/reset-special-colors/index.html.md): Put xterm's special colors back as they started.
- [OSC 116: Reset Tektronix Background Color](https://control-codes.page/osc/reset-tek-background/index.html.md): Put the tektronix background color back as it started.
- [OSC 118: Reset Tektronix Cursor Color](https://control-codes.page/osc/reset-tek-cursor/index.html.md): Put the tektronix cursor color back as it started.
- [OSC 115: Reset Tektronix Foreground Color](https://control-codes.page/osc/reset-tek-foreground/index.html.md): Put the tektronix foreground color back as it started.
- [OSC 111: Reset Text Background Color](https://control-codes.page/osc/reset-background/index.html.md): Put the text background color back as it started.
- [OSC 112: Reset Text Cursor Color](https://control-codes.page/osc/reset-cursor-color/index.html.md): Put the text cursor color back as it started.
- [OSC 110: Reset Text Foreground Color](https://control-codes.page/osc/reset-foreground/index.html.md): Put the text foreground color back as it started.
- [OSC 9 ; 6: Run a Macro](https://control-codes.page/osc/conemu-macro/index.html.md): Run a ConEmu GuiMacro.
- [OSC 9 ; 7: Run a Process](https://control-codes.page/osc/conemu-run/index.html.md): Run a program.
- [OSC 777: Perl Extension Command](https://control-codes.page/osc/rxvt/index.html.md): Pass a string to one of rxvt-unicode's Perl extensions; with the prefix notify, show a desktop notification.
- [OSC 702: Report Version](https://control-codes.page/osc/urxvt-version/index.html.md): Ask rxvt-unicode for its name and version.
- [OSC 720: Scroll View Up](https://control-codes.page/osc/scroll-view/index.html.md): Move rxvt-unicode's view up or down its scrollback, or clear the scrollback.
- [OSC 21337: Session Status](https://control-codes.page/osc/iterm2-status/index.html.md): Set the status text and indicator iTerm2 shows in a tab.
- [OSC 176: Set App ID](https://control-codes.page/osc/app-id/index.html.md): Set the app ID that a Wayland compositor, or an X window manager, groups and decorates the terminal's window by.
- [OSC 50: Set Font](https://control-codes.page/osc/font/index.html.md): Change xterm's font, or ask which one it is using.
- [OSC 710: Set Normal Font](https://control-codes.page/osc/urxvt-font/index.html.md): Set rxvt-unicode's normal, bold, italic or bold italic font, or ask for it.
- [OSC 1: Set Icon Name](https://control-codes.page/osc/icon/index.html.md): Set the name the window manager shows for the terminal's window when it is iconified.
- [OSC 0: Set Icon Name and Window Title](https://control-codes.page/osc/icon-and-title/index.html.md): Set the window's title and its icon name to the same text.
- [OSC L: Set Icon Name (dtterm)](https://control-codes.page/osc/dtterm-icon/index.html.md): Set the icon name, as Sun's terminals and dtterm did.
- [OSC I: Set Icon (dtterm)](https://control-codes.page/osc/dtterm-icon-file/index.html.md): Set the window's icon from a file, as dtterm did.
- [OSC P: Set Palette (Linux)](https://control-codes.page/osc/linux-palette/index.html.md): Change a palette color, as the Linux console does.
- [OSC 2: Set Window Title](https://control-codes.page/osc/title/index.html.md): Set the title of the terminal's window or tab.
- [OSC l: Set Window Title (dtterm)](https://control-codes.page/osc/dtterm-title/index.html.md): Set the window title, as Sun's terminals and dtterm did.
- [OSC 3: Set X Property](https://control-codes.page/osc/x-property/index.html.md): Set or delete a property on the terminal's top-level X window.
- [OSC 133: Semantic Prompt](https://control-codes.page/osc/prompt/index.html.md): Mark where a shell's prompt, the command typed at it, and the command's output begin and end.
- [OSC 9 ; 1: Sleep](https://control-codes.page/osc/conemu-sleep/index.html.md): Pause output for a number of milliseconds.
- [OSC 106: Special Color Modes](https://control-codes.page/osc/color-mode-106/index.html.md): The same as OSC 6: turn xterm's special colors on and off.
- [OSC 6: Enable Special Color](https://control-codes.page/osc/color-mode/index.html.md): Turn on or off xterm's use of a special color for bold, underlined, blinking, reversed or italic text.
- [OSC 5: Change Special Color](https://control-codes.page/osc/special-colors/index.html.md): Set and query the colors xterm can draw bold, underlined, blinking, reversed and italic text in.
- [OSC 34: Tab Color (Konsole)](https://control-codes.page/osc/konsole-tab-color/index.html.md): Set the color of Konsole's tab.
- [OSC 32: Tab Icon (Konsole)](https://control-codes.page/osc/konsole-tab-icon/index.html.md): Set the icon of Konsole's tab.
- [OSC 9 ; 3: Tab Title](https://control-codes.page/osc/conemu-tab-title/index.html.md): Set the text of the tab.
- [OSC 30: Tab Title (Konsole)](https://control-codes.page/osc/konsole-tab-title/index.html.md): Set the title of Konsole's tab.
- [OSC 16: Tektronix Background Color](https://control-codes.page/osc/tek-background/index.html.md): Set and query the color of the background of xterm's Tektronix 4014 window.
- [OSC 18: Tektronix Cursor Color](https://control-codes.page/osc/tek-cursor/index.html.md): Set and query the color of the cursor in xterm's Tektronix 4014 window.
- [OSC 15: Tektronix Foreground Color](https://control-codes.page/osc/tek-foreground/index.html.md): Set and query the color of what is drawn in xterm's Tektronix 4014 window.
- [OSC 666: Set Terminal Property](https://control-codes.page/osc/termprop/index.html.md): Set, reset or signal VTE's typed terminal properties, which the program embedding VTE can watch.
- [OSC 11: Text Background Color](https://control-codes.page/osc/background/index.html.md): Set and query the color of the default background, behind text with no SGR background color.
- [OSC 12: Text Cursor Color](https://control-codes.page/osc/cursor-color/index.html.md): Set and query the color of the text cursor.
- [OSC 10: Text Foreground Color](https://control-codes.page/osc/foreground/index.html.md): Set, query and reset the default foreground color.
- [OSC 66: Text Sizing](https://control-codes.page/osc/text-sizing/index.html.md): Draw text larger than one cell, or in a width the program chooses: kitty's text sizing protocol.
- [OSC 633: VS Code Shell Integration](https://control-codes.page/osc/vscode/index.html.md): VS Code's marks for prompts, commands and their output, with the command line and properties added to OSC 133's.
- [OSC 9 ; 5: Wait for a Key](https://control-codes.page/osc/conemu-wait/index.html.md): Wait for Enter, Space or Esc.
- [OSC 7: Report Working Directory](https://control-codes.page/osc/cwd/index.html.md): Tell the terminal which directory the shell is in.
- [OSC 9 ; 9: Working Directory](https://control-codes.page/osc/conemu-cwd/index.html.md): Tell the terminal the shell's working directory, the ConEmu way.
- [OSC 31: Working Directory (old Konsole)](https://control-codes.page/osc/konsole-cwd/index.html.md): Tell Konsole the shell's working directory, as Konsole once read it.
- [OSC 9 ; 10: xterm Emulation](https://control-codes.page/osc/conemu-xterm/index.html.md): Turn ConEmu's xterm emulation on or off.

## Parsing

- [C0 in sequences: Controls Inside Sequences](https://control-codes.page/parser/controls/index.html.md): What a control character does when it arrives in the middle of a control sequence or a string.
- [Parameters: Parameters](https://control-codes.page/parser/parameters/index.html.md): How many parameters a control sequence can carry, and what happens to ones that are malformed.
- [UTF-8: UTF-8 and C1 Controls](https://control-codes.page/parser/utf8/index.html.md): What a terminal reading UTF-8 does with bytes that are not valid UTF-8, and with the C1 controls.

## Proposals

- [APC 25a1: Glyph Protocol](https://control-codes.page/proposals/glyph/index.html.md): A proposal for a program to send its terminal vector glyphs for Private Use Area code points, so that icons render without a patched font.
- [OSC 7501: Program Status Protocol](https://control-codes.page/proposals/osc-7501/index.html.md): A proposal for a program to tell its terminal what it is doing: idle, working, waiting on the user, finished, or failed, and why.
- [OSC 88: Terminal Resume Protocol](https://control-codes.page/proposals/osc-88/index.html.md): A proposal for a program to tell its terminal how to relaunch it when the terminal itself is restarted.

## Guides

- [Control sequences by final byte](https://control-codes.page/finals/index.html.md): Every control sequence on this site, listed by the byte it ends with, to look up a CSI sequence from what it ends in.
- [Notation](https://control-codes.page/notation/index.html.md): How syntax diagrams and validation cases are written on this site.
- [Sources](https://control-codes.page/sources/index.html.md): The documents each sequence page cites, and how the citations link to them.
- [The Rest of ECMA-48](https://control-codes.page/catalog/index.html.md): The ECMA-48 control functions that terminals do not use, grouped by what they were for.
- [Support](https://control-codes.page/support/index.html.md): Which terminals support which control sequences, page by page.

---

This is the Markdown version of <https://control-codes.page/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.
