Discord ANSI Color Codes

Every colour and style code Discord understands, in one table. Copy a snippet here, or let the colored text generator write the invisible escape characters for you.

How ANSI color codes work in Discord

Discord reads a small subset of ANSI escape sequences β€” the same control codes terminals have used for decades. Wrap them in a fenced code block tagged ansi and the client interprets them instead of printing them:

```ansi
This line is red
```

ESC is the invisible escape character (0x1B). You cannot type it on a normal keyboard, which is why most people either copy a message that already contains it or use a generator. Discord also requires the extra 2; prefix before the classic 30–37 and 40–47 codes β€” plain terminal ANSI without it renders as raw characters.

The 8 Discord ANSI color codes

Text colours use ESC[2;3Xm; the matching background is ESC[2;4Xm with the same last digit. Every row copies a block that shows both.

PreviewColorTextBackgroundHexCopy
BlackESC[2;30mESC[2;40m#2a2d32
RedESC[2;31mESC[2;41m#ed4245
GreenESC[2;32mESC[2;42m#57f287
YellowESC[2;33mESC[2;43m#fee75c
BlueESC[2;34mESC[2;44m#5865f2
PinkESC[2;35mESC[2;45m#eb459e
TealESC[2;36mESC[2;46m#1abc9c
WhiteESC[2;37mESC[2;47m#dcddde

Black renders as Discord's dark grey rather than pure black, and White is a light grey β€” those are the actual palette values the client uses, so a black background always reads as a soft dark block.

Text style codes

Styles are separate sequences that stack on top of whatever colour is active.

StyleCodeNotesCopy
ResetESC[0mClears every colour and style that came before it.
BoldESC[1mHeavier weight. Supported on every Discord client.
ItalicESC[3mSlanted text. Needs a reasonably recent client.
UnderlineESC[4mUnderlines the text. Supported on every Discord client.
StrikethroughESC[9mPuts a line through the text. Newer clients only.

24-bit truecolor (any RGB value)

Beyond the eight palette colours, recent Discord clients accept arbitrary RGB values:

  • Text: ESC[38;2;R;G;Bm β€” for example ESC[38;2;255;105;180m for hot pink.
  • Background: ESC[48;2;R;G;Bm β€” for example ESC[48;2;88;101;242m for Discord blurple.

Truecolor sequences are much longer than ESC[2;31m, so on long messages they eat into Discord's 2000-character limit far faster. The eight palette codes remain the safest choice for anything lengthy.

Combining codes β€” worked examples

Red bold warning

SERVER RESTART in 5 minutes

Bold and colour stack - send each attribute as its own sequence.

Green success line

βœ” Build passed

One colour, one reset. The shortest reliable form.

Blue on pink highlight

 ANNOUNCEMENT 

Background first, then foreground - order does not matter, both apply.

Two colours in one message

Question: what time?

Reset between colours so the first one does not bleed into the second.

Truecolor heading

Hot pink heading

24-bit values work alongside the classic eight.

Cheat sheet β€” copy the whole block

```ansi
  reset everything
  bold          italic        underline     strikethrough
 black    red      green    yellow  
 blue     pink     teal     white   
 bg black bg red   bg green bg yellow
 bg blue  bg pink  bg teal  bg white 
 truecolor text     truecolor background
```

Client differences to know about

  • Desktop, web and mobile all render the eight palette colours today. Very old mobile builds showed raw escape characters β€” updating the app fixes that.
  • Bold and underline are the two styles you can rely on everywhere.
  • Italic and strikethrough depend on client version; if they do not appear, the rest of the message still renders correctly.
  • Truecolor support arrived later than the palette, so a handful of older clients fall back to the nearest palette colour.
  • No Nitro required. Codes live inside a code block, which Discord renders for every account.

Related guides