Skip to main content
Formatting & Style

How to Write in Color in Discord: The Complete ANSI Syntax Guide

Learn how to write colored text in Discord messages using ANSI escape sequences. Master all 8 colors, background highlights, bold formatting, and 1-click copy tricks.

Rayyan
2026-09-29
14 min read

Key Takeaways & Summary

  • •Colored text requires wrapping your message in a triple-backtick codeblock declared with 'ansi'.
  • •Colors are initiated using the escape character sequence '\u001b[CODEm' and cleared with '\u001b[0m'.
  • •Discord supports 8 foreground text colors (Dark Gray, Red, Green, Yellow, Blue, Pink, Cyan, and White).
  • •ANSI codeblocks render in color on Discord Desktop and Web clients; on some mobile app releases, they render in standard monospaced text.
  • •Our Discord Colored Text Generator lets you type, highlight, and copy complete ANSI codeblocks with zero syntax errors.
Desktop & Mobile App Support:Tested and verified for Discord desktop, web browser, and mobile apps (iOS & Android).

Learn how ANSI escape codes inside codeblocks turn plain Discord chat into vibrant red, green, blue, yellow, and highlighted announcement banners.

For years, Discord users relied on clumsy syntax highlighting hacks (like using yaml or diff codeblocks) to simulate colors in chat. However, Discord introduced native support for ANSI terminal escape sequences inside codeblocks denoted with the 'ansi' syntax language tag. By leveraging ANSI escape codes, you can format individual words or entire paragraphs with 8 distinct text colors, 8 background highlight fills, bold typography, and underlined emphasis. In this guide, we break down the exact escape code syntax, provide copyable templates for moderation banners, and explain mobile compatibility.

The ANSI Escape Code Syntax Structure

ANSI terminal formatting relies on control sequences that instruct terminal emulators how to style text. To write colored text in Discord, you open a codeblock with ```ansi and write your message using this pattern:

\u001b[STYLE;COLORmYour Text Here\u001b[0m

Where: - \u001b: The unprintable Escape character (ASCII 27 / Hex 1B). - [: Opening bracket for the Control Sequence Introducer (CSI). - STYLE: 0 for normal, 1 for bold, 4 for underline. - COLOR: Two-digit numeric code specifying foreground or background color. - m: Terminating command letter. - \u001b[0m: Reset sequence that prevents colors from bleeding into subsequent text.

Multi-colored server announcement using Discord ANSI syntaxansi
```ansi
[CRITICAL] Server reboot in progress
[SUCCESS] All services online
[WARNING] High latency detected on EU node
[INFO] Community game night starts tonight
```

Complete Discord ANSI Color Code Reference Chart

Here are all supported color codes in Discord:

ColorForeground CodeBackground CodeBest Practice Usage
Dark Gray3040Timestamps, footers, subtle metadata
Red3141Errors, urgent alerts, rule violations
Green3242Success notices, bot online indicators
Yellow3343Warnings, maintenance reminders
Blue3444Information banners, hyperlinks, guides
Pink / Magenta3545Events, giveaways, VIP role announcements
Cyan3646Commands, channel names, role tags
Bright White3747High-contrast headings and callouts
Related Search Queries & Topics
how to make colored text in discorddiscord colored textdiscord ansi color text generatordiscord text color codesdiscord red text copy pastecolored discord text

Frequently Asked Questions

Straightforward answers to common questions about this topic.

This happens if you forgot to specify 'ansi' after the opening triple backticks, or if your text editor replaced the literal escape character with plain text. Use our visual editor to generate clean, verified escape tokens.

Generate Your Discord Timestamps Now

Convert any date or countdown into auto-adjusting Discord tags with 1-click copy.

Open Free Generator