ANSI Color Codes Reference
Look up common SGR styles, the 16- and 256-color palettes and true color. Preview ANSI-styled text locally.
Enabling local controls…
Paste text containing ESC or use \e, \x1b, \033, \u001b. Double backslashes to display a literal backslash.
Compose colors and styles
ANSI preview
✓ Build ready ! Review output RGB background
SGR color and style reference
| Style | Enable | Reset |
|---|---|---|
| Reset all | — | \e[0m |
| Bold | \e[1m | \e[22m |
| Faint | \e[2m | \e[22m |
| Italic | \e[3m | \e[23m |
| Underline | \e[4m | \e[24m |
| Reverse | \e[7m | \e[27m |
| Conceal | \e[8m | \e[28m |
| Strikethrough | \e[9m | \e[29m |
| Overline | \e[53m | \e[55m |
| Color | Foreground | Background |
|---|---|---|
| Default | \e[39m | \e[49m |
| Black | \e[30m | \e[40m |
| Red | \e[31m | \e[41m |
| Green | \e[32m | \e[42m |
| Yellow | \e[33m | \e[43m |
| Blue | \e[34m | \e[44m |
| Magenta | \e[35m | \e[45m |
| Cyan | \e[36m | \e[46m |
| White | \e[37m | \e[47m |
| Bright black (gray) | \e[90m | \e[100m |
| Bright red | \e[91m | \e[101m |
| Bright green | \e[92m | \e[102m |
| Bright yellow | \e[93m | \e[103m |
| Bright blue | \e[94m | \e[104m |
| Bright magenta | \e[95m | \e[105m |
| Bright cyan | \e[96m | \e[106m |
| Bright white | \e[97m | \e[107m |
Terminal themes can change the first 16 colors. The examples use the xterm reference palette.
256 indexed colors
\e[38;5;nm · \e[48;5;nm
Show the complete indexed palette
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
24-bit RGB true color
\e[38;2;R;G;Bm · \e[48;2;R;G;Bm
Each channel accepts 0–255. For example, \e[38;2;255;165;0m sets an orange foreground.
How to use this tool
Paste an SGR sequence with text, or compose one from the standard color and style controls. Look up indexed and RGB colors below the preview.
When not to use it
The preview accepts only the listed Select Graphic Rendition (SGR) styles and colors, with up to 16,000 UTF-16 units and 512 sequences. It rejects non-SGR controls and unsupported style codes. Everything renders as browser text. Terminal fonts and palettes may differ.