# Standards for ANSI escape codes

DevFeed: [Standards for ANSI escape codes](<https://devfeed.tech/articles/standards-for-ansi-escape-codes-21119.md>)

Original publisher: [Read original article](<https://jvns.ca/blog/2025/03/07/escape-code-standards/>)

Author: Julia Evans

Published: 2025-03-07T00:00:00Z

Content type: article

Language: en

Sources: [Julia Evans](<https://devfeed.tech/sources/julia-evans.md>)

Topics: [Terminal](<https://devfeed.tech/topics/terminal.md>), [Code](<https://devfeed.tech/topics/code.md>), [Usability](<https://devfeed.tech/topics/usability.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [remote](<https://devfeed.tech/tags/remote.md>), [standards](<https://devfeed.tech/tags/standards.md>), [terminal](<https://devfeed.tech/tags/terminal.md>), [usability](<https://devfeed.tech/tags/usability.md>)

## AI overview

An introduction to ANSI escape codes, their role in terminal input and output, their usability benefits, and the standards that define them. The article explains that incomplete standardization can make escape codes unreliable and difficult to troubleshoot, and discusses ECMA-48 as an early standard.

## Source excerpt

Hello! Today I want to talk about ANSI escape codes. For a long time I was vaguely aware of ANSI escape codes ("that's how you make text red in the terminal and stuff") but I had no real understanding of where they were supposed to be defined or whether or not there were standards for them. I just had a kind of vague "there be dragons" feeling around them. While learning about the terminal this year, I've learned that: ANSI escape codes are responsible for a lot of usability improvements in the terminal (did you know there's a way to copy to your system clipboard when SSHed into a remote machine?? It's an escape code called OSC 52!) They aren't completely standardized, and because of that they don't always work reliably. And because they're also invisible, it's extremely frustrating to troubleshoot escape code issues. So I wanted to put together a list for myself of some standards that exist around escape codes, because I want to know if they have to feel unreliable and frustrating, or if there's a future where we could all rely on them with more confidence. what's an escape code? ECMA-48 xterm control sequences terminfo should programs use terminfo? is there a "single common set" of escape codes? some reasons to use terminfo some more documents/standards why I think this is interesting what's an escape code? Have you ever pressed the left arrow key in your terminal and seen ^[[D? That's an escape code! It's called an "escape code" because the first character is the "escape" character, which is usually written as ESC, \x1b, \E, \033, or ^[. Escape codes are how your terminal emulator communicates various kinds of information (colours, mouse movement, etc) with programs running in the terminal. There are two kind of escape codes: input codes which your terminal emulator sends for keypresses or mouse movements that don't fit into Unicode. For example "left arrow key" is ESC[D, "Ctrl+left arrow" might be ESC[1;5D, and clicking the mouse might be something like ESC[M :3