Tools
Discord text formatting
What to type for every style Discord has, what it looks like, and the catches. Each one copies.
The same codes work in messages, in bot replies and in embed descriptions and field values. They do not work in usernames, channel names or the server name.
Text
| Type | You get | Notes |
|---|---|---|
*italic* or _italic_ | italic | |
**bold** | bold | |
***bold italic*** | bold italic | |
__underline__ | underline | Two underscores. One underscore on each side is italic. |
__*underline italic*__ | underline italic | Styles stack: put one inside another. |
~~strikethrough~~ | ||
||spoiler|| | spoiler | Hidden until someone clicks it. |
Code
| Type | You get | Notes |
|---|---|---|
`inline code` | inline code | Nothing inside is formatted, so it also shows markdown as typed. |
```py
print("hello")
``` | print("hello") | A code block. The word after the first three backticks (py, js, json, diff, ...) turns on colouring. |
Lines and blocks
| Type | You get | Notes |
|---|---|---|
# Big heading | Big heading | At the start of a line, with a space after the #. |
## Medium heading | Medium heading | |
### Small heading | Small heading | |
-# small grey text | small grey text | Subtext, for footnotes and fine print. |
> one quoted line | one quoted line | |
>>> everything after this
is quoted | everything after this is quoted | Quotes the rest of the message, every line. |
- an item
- another
- indented |
| - or * for bullets; two spaces in front to indent. |
1. first
2. second |
|
Links, mentions and the rest
| Type | You get | Notes |
|---|---|---|
[link text](https://example.com) | link text | A masked link. Discord asks before opening a site the reader has not trusted. |
<https://example.com> | https://example.com | Angle brackets: the link without a preview card. |
<@USER_ID> | @someone | A user. Turn on Developer Mode, right-click, Copy ID. |
<@&ROLE_ID> | @Role | A role. |
<#CHANNEL_ID> | #channel | A channel. |
</ping:COMMAND_ID> | /ping | A slash command people can click to start typing. |
<t:1800000000:R> | in 3 months | A timestamp, shown in each reader's own time zone. Make one. |
\*not italic\* | *not italic* | A backslash shows the next character as typed. |
From a bot
A bot sends the same text: **bold** in a reply is bold. Both libraries can escape text you did not write, so a username with asterisks or a || in a form answer does not turn into formatting:
# discord.py
discord.utils.escape_markdown("**not bold**") # \*\*not bold\*\*
discord.utils.escape_mentions("@everyone") # cannot ping anyone
// discord.js
const { escapeMarkdown, bold, heading, subtext, hyperlink } = require("discord.js");
escapeMarkdown("**not bold**"); // \*\*not bold\*\*
heading("Patch notes", 2); // ## Patch notes
hyperlink("the docs", "https://example.com"); // [the docs](https://example.com)
To stop a message pinging people at all, whatever it says, send it with no allowed mentions: allowed_mentions=discord.AllowedMentions.none() in discord.py, allowedMentions: { parse: [] } in discord.js.