# ANSI Escape Code

*noun*

say it: **“AN-see es-KAYP KOHD”** **/ˈænsi ɪˈskeɪp ˈkoʊd/**

A short code a terminal reads as an instruction, such as a color change, instead of printing it as text.

## What is an **ANSI escape code**?

An **ANSI escape code** is a short code a terminal obeys instead of printing: it starts with the escape character (written `\e` or `\033`), then `[`, numbers and a letter. `\e[1;36m` turns on bold cyan, and `\e[0m` goes back to normal. Bash prompts, `ls` colors and PowerShell's colored output all use them; in `PS1`, wrap each one in `\[` and `\]` so bash knows it takes no room.

```bash
printf '\e[1;36m%s\e[0m\n' 'bold cyan'
```

## In a sentence

- “An **ANSI escape code** turned the folder name in Sam's prompt bold cyan, and a second one turned the color off.”
- “The log looked full of strange characters, because each **ANSI escape code** had been saved as text.”

Level: Journeyman · [More Operating System terms at this level](https://www.ask-codey.com/glossary?category=operating-system&level=3)

Updated: November 10, 2026

Source: https://www.ask-codey.com/glossary/ansi-escape-code
