Discord Colored Text: How to Use ANSI Color Codes
Add red, green, and blue Discord colored text with ANSI color codes. Get the full code reference, worked examples, and fixes for text that will not color.
Yes, Discord can show colored text—red, green, blue, and more—but not through native markdown. There is exactly one method: an ansi code block. This guide covers Discord ANSI color codes in full: a color reference, worked ESC sequences you can rebuild in the tool, and fixes for the errors that leave your text plain. The examples below spell out ESC as a stand-in for an invisible control character, so generate the real block rather than copying these placeholders.
What makes colored text possible
Discord runs a small ANSI renderer inside code blocks tagged ansi: triple backticks with ansi on its own line, then your content, then closing backticks. The tag must be exactly ansi, lowercase and with no space—an inline single-backtick span will not color anything. Every color sequence has the same anatomy: the ESC character, an opening [, one or more codes separated by semicolons, and a closing m. So ESC[31m starts red and ESC[0m resets. Without the trailing m, nothing parses.
Discord ANSI color codes: the full reference
Discord exposes an 8-color palette, each hue usable as a foreground (30–37) or background (40–47), plus three style codes. It renders them on a Solarized-based dark palette, so shades look a little different from a standard terminal: blue leans toward #268bd2, and yellow reads as gold. The rendering does not change with your light or dark Discord theme.
Style codes:
0— reset all colors and styles1— bold (also renders a bit brighter)4— underline
Foreground (text) colors, 30–37:
30gray,31red,32green,33yellow34blue,35pink (magenta),36cyan,37white
Background colors, 40–47, follow the same order (40 black through 47 white). On Discord's palette several read as blue or gray rather than their nominal color, so always pair a background with a contrasting foreground.
How to make colored text in Discord (step by step)
Build a single red line like this:
- Open a code block and tag it
ansi. - Type
ESC[31m(the ESC character followed by[31m). - Type your text, for example: This is red.
- Close the color with
ESC[0mso it does not bleed into the rest of the block. - Close the code block with triple backticks.
The catch is the ESC character: it is invisible and you cannot type it, so copy a finished block from a generator rather than retyping the codes here.
Combining bold, color, and backgrounds
Stack a style, a foreground, and a background in one sequence by separating the codes with semicolons. ESC[1;31m is bold red. ESC[4;36m is underlined cyan. ESC[1;4;33;44m is bold, underlined, yellow on a blue background. Put the codes before the text and reset after. Foreground and background order does not matter, but when you list two codes of the same kind, the later one wins.
There is no rainbow or gradient code. To fake rainbow text, put a fresh color before each word or letter—cycling 31, 33, 32, 36, 34, 35—and reset at the end. It works, but the repeated codes and invisible ESC bytes burn through your character budget fast. Smooth gradients are impossible, since 256-color and RGB modes are not supported.
The ESC character problem
The escape character is Unicode U+001B, a non-printable control character. Your keyboard's Esc key closes the message box; it does not insert this character. That is why plain backticks never produce color—and why the visible ESC[31m text on this page will not work if you paste it, since it holds no real ESC byte. Two reliable ways to get one:
- Use a Discord colored text generator, which bakes the invisible ESC into its copy-paste output.
- Paste it from a code editor that can insert the raw escape byte.
Why isn't my text colored?
If your ansi block renders as plain text, it is almost always one of these:
- You used plain triple backticks instead of tagging the block. The tag must be exactly
ansi—lowercase, no space, right after the backticks. - The ESC character got stripped when you copied or hand-edited the block. Regenerate it rather than editing near a code boundary.
- You forgot the
ESC[0mreset, so a color bled through—or you used a wrong or unclosed code. - You tried 256-color (
38;5;n) or RGB (38;2;r;g;b), which are confirmed unsupported and render as plain text. Bright colors (90–97) are not part of the reliably supported set either—use bold (1) with a base color for a brighter look.
Rendering also splits by client. Colors show on the desktop apps and the web client, but mobile rendering is inconsistent—most mobile clients still show plain, colorless monospace. Never rely on color alone; design the message so it reads without it.
Next steps
For every other Discord style—bold, italics, spoilers, headers, code blocks, and subtext—see the companion Discord Text Formatting cheat sheet. For color inside real server announcements, see the guide on formatting Discord messages with markdown. Before you post, Markdown2Social previews the Discord result so you catch a stripped ESC or a missing reset first. And watch your length: Discord caps messages at 2,000 characters, and every invisible ESC and code counts toward it.