← Back to Blogs Tutorials Last updated 7 min read

How to Write in Color on Discord (ANSI Text Formatting)

How to Write in Color on Discord (ANSI Text Formatting)
Make colored text instantly with our tool Type your text, pick colors and highlights, add a rainbow or custom color sequence, and copy the ready-to-paste ANSI code straight into Discord.
Click here to use the automatic color text generator

Colored text on Discord is not normal Markdown. It uses ANSI escape codes inside a special code block. This is the most technical formatting option on Discord, but once you understand the pattern, it is easy to reuse. You cannot just type colors like bold or italic. You need to use a specific syntax with escape characters.

This guide covers how to write in color on Discord using ANSI codes for text color, background color, and bold or underlined colored text. For a complete reference of every formatting option, check out The Ultimate Discord Text Formatting Guide.


How Discord ANSI Coloring Works

ANSI coloring on Discord uses three parts:

  1. A ```ansi code block to activate ANSI mode.
  2. Escape codes inserted before each word or line to set the color.
  3. A reset code ([0m) to stop the color so the next text can use a different one.

Every color code starts with an invisible character called the escape character (Unicode U+001B). You cannot type it on most keyboards, so every example on this page includes it in a copy-paste-ready box. The escape character appears as a small symbol before each [ in the copy boxes below. Here is the red-text template:

```ansi
This text is red
```

Click Copy Rules and paste into a ```ansi block. 31 means red, 0 means reset. For the quickest setup, use our free Discord Colored Text Generator instead.


How to Write Colored Text on Discord Desktop

Follow these steps exactly to get colored text working.

Step 1: Open a Code Block

Type ```ansi and press Enter. This tells Discord to interpret ANSI escape codes instead of regular text.

Step 2: Paste or Type the Color Code

Use the escape character followed by the color number and m. Copy this green text example and replace the words:

```ansi
Your text here
```

The [0m at the end resets the color so the next text is not also green.

Step 3: Close the Code Block

Type ``` on its own line at the end to close the block.

Complete example for a message with two colors (copy the full block below):

```ansi
This is red
This is green
```

Click Copy Rules and paste directly into Discord. The escape characters are included.


ANSI Color Reference Table

Here are all the text colors you can use on Discord. Copy the block below into a ```ansi block and replace text with your own words.

```ansi
text  Gray
text  Red
text  Green
text  Yellow
text  Blue
text  Pink
text  Cyan
text  White
```
CodeColorCodeColor
30
Gray
34
Blue
31
Red
35
Pink
32
Green
36
Cyan
33
Yellow
37
White

ANSI Background Colors

Codes 40 to 47 add a colored background behind the text. Copy the example below into your ```ansi block.

```ansi
Dark text on red background
Dark text on green background
White text on yellow background
White text on blue background
Dark text on pink background
White text on cyan background
```

The first number after [ (like 30) is the text color. The second number after the semicolon (like 41) is the background color. Most people use 30 (dark gray) or 37 (white) for text on colored backgrounds so the text stays readable. Replace the words and send.

CodeUsageExample
40
[40m Gray bg
Gray bg
41
[41m Red bg
Red bg
42
[42m Green bg
Green bg
43
[43m Yellow bg
Yellow bg
44
[44m Blue bg
Blue bg
45
[45m Pink bg
Pink bg
46
[46m Cyan bg
Cyan bg
47
[47m White bg
White bg

To combine text color and background, use [XX;YYm where XX is the text color (30-37) and YY is the background (40-47). For readable results, use 30 (dark gray) or 37 (white) for text with colored backgrounds. The escape character goes before the bracket, as in all the copy boxes above.


Bold and Underlined Colored Text

Colored text blocks can only be combined with bolding and underlining, and this cannot be done manually. Discord needs several style codes stacked in the exact right order, and getting that right by hand is unreliable. The simplest way is to use our Discord Colored Text Generator: select your colored text, click Bold or Underline, and copy the finished code block into Discord.


ANSI Colors on Discord Mobile

Colored text does not render in the Discord mobile app. Messages sent with ANSI colors appear as plain monochrome text on iOS and Android. The colors are only visible on Discord desktop and web, so build and send colored messages from a desktop or web client.

iOS (iPhone / iPad)

  1. 1

    Copy the full ANSI code example (including the escape characters) from a desktop source.

  2. 2

    Open Discord and type ```ansi then press Return.

  3. 3

    Paste the code and replace the example text with your own words.

  4. 4

    Close with ``` on a new line and send.

Android

  1. 1

    Save a note with your ANSI templates so you can copy-paste them on mobile.

  2. 2

    Open the note, copy the template, and paste it into a ```ansi block on Discord.

  3. 3

    Edit the pasted text to replace the example words with your own.

  4. 4

    Close the code block and send. The colors render once the message is sent.

Tip Save your templates: Keep a text file or note with your most-used ANSI templates. That way you can copy-paste them on any device without rebuilding the codes from scratch.

ANSI Not Working on Discord? Try These Fixes

Common Issues

  • You forgot the ansi language tag. Regular ``` without ansi does not process escape codes. You must type ```ansi at the start.
  • The escape character is missing or wrong. The invisible character before each bracket must be the actual Unicode escape character (U+001B). Copying from a working example is the easiest way to get it right.
  • You forgot the reset code. Without [0m at the end, all text after your colored word stays in that color. Always reset with [0m after each colored section.
  • The color code is wrong. Use codes 30 to 37 for text colors and 40 to 47 for backgrounds. Numbers outside this range (like 38 or 39) may not work on Discord.
  • You are not inside a code block. ANSI escape codes only work inside ```ansi blocks. Typing them in a regular message shows the raw characters.

ANSI Color Discord FAQ

How do I type colored text on Discord?
Use a ```ansi code block with ANSI escape codes. Each color has a number code (31 for red, 32 for green, etc.) preceded by an invisible escape character. Copy a working template and replace the text.
What is the escape character for Discord ANSI?
The escape character is Unicode U+001B. You cannot type it directly on most keyboards. Copy it from an existing ANSI template or use a character map tool to insert it.
Can I use multiple colors in one message?
Yes. Use a separate color code for each section and reset with [0m between them. For example: [31mred text[0m [32mgreen text[0m with the escape character before each bracket.
Does colored text work on Discord mobile?
No. The Discord mobile app does not render ANSI colored text, so it appears as plain monochrome text on iOS and Android. The colors are only visible on Discord desktop and web.
How do I make text bold and colored at the same time?
Colored text blocks can only be combined with bolding and underlining through the generator, and this cannot be done manually. Select your colored text in the Discord Colored Text Generator and use the Bold and Underline buttons.
Why is my ANSI code showing as raw text instead of colors?
You likely used a regular code block (```) instead of an ANSI code block (```ansi). Make sure the language tag is set to ansi, or the escape codes will display as literal text.