How to Format Markdown in a Discord Webhook Message
🔍 WiseChecker

How to Format Markdown in a Discord Webhook Message

Discord webhooks let you send automated messages to channels from external apps or scripts. But plain text messages often look messy and lack emphasis. Markdown formatting solves this by letting you add bold, italics, code blocks, lists, and more directly inside your webhook payload. This article explains the supported Markdown syntax for webhook messages and shows you how to apply it in the JSON payload.

Key Takeaways: Markdown Syntax for Discord Webhook Messages

  • Double asterisks for bold: Wrap text in text to make it bold.
  • Single asterisk for italic: Use text to italicize.
  • Backticks for inline code: Enclose code in single backticks `code`.
  • Triple backticks for code blocks: Use three backticks with optional language name for multi-line code.

Supported Markdown in Discord Webhook Messages

Discord webhook messages support the same Markdown formatting that regular chat messages do. The Markdown is parsed in the content field of the JSON payload. You can also apply Markdown inside embedded message fields. The following Markdown elements work in webhook content:

Text Formatting

Bold — Use double asterisks: bold text renders as bold text.
Italic — Use single asterisk: italic text renders as italic text.
Bold and Italic — Use triple asterisks: bold italic renders as bold italic.
Underline — Use double underscores: __underlined text__ renders as underlined text.
Strikethrough — Use double tildes: ~~strikethrough text~~ renders as strikethrough text.
Spoiler — Use double vertical bars: ||spoiler text|| hides the text behind a click-to-reveal overlay.

Code Formatting

Inline code — Wrap in single backticks: `code snippet` renders as code snippet.
Code block — Wrap in triple backticks. Optionally add a language name after the opening backticks for syntax highlighting. Example:

```python
print("Hello")
```

Lists

Unordered list — Start each line with a hyphen or asterisk followed by a space.
Ordered list — Start each line with a number and a period followed by a space. Example:

1. First item
2. Second item
3. Third item

Blockquotes

Start a line with a right angle bracket > followed by a space. Example:

> This is a blockquote

Headings

Use hash symbols at the start of a line. Discord supports up to three levels: # Heading 1, ## Heading 2, ### Heading 3. Note that headings in webhook messages often appear smaller than in regular chat.

Steps to Send a Markdown-Formatted Webhook Message

To format Markdown in a Discord webhook message, you send a POST request to the webhook URL with a JSON payload. The Markdown goes inside the content string or inside the description field of an embed. Below are the steps using a simple Python script as an example. You can adapt these steps to any programming language or tool that sends HTTP POST requests.

  1. Get your webhook URL
    Open Discord and go to Server Settings > Integrations > Webhooks. Click the webhook you want to use or create a new one. Copy the webhook URL. It looks like: https://discord.com/api/webhooks/123456/abcdef.
  2. Create the JSON payload with Markdown
    Write a JSON object with a content key. The value is a string that includes Markdown syntax. For example:
    { "content": "Hello from webhook!" }
  3. Send the POST request
    Use a tool like Python’s requests library, curl, or Postman. The request body must be JSON and the Content-Type header must be application/json. Example Python code:
    import requests
    url = "YOUR_WEBHOOK_URL"
    data = {"content": "Bold and italic text"}
    requests.post(url, json=data)
  4. Verify the message in Discord
    Check the channel where the webhook posts. The Markdown should render as formatted text. If it shows plain text, the webhook URL may be incorrect or the payload format is wrong.

Common Mistakes and Limitations

Markdown Shows as Plain Text

This happens when the content field contains escaped characters or when the webhook URL points to a different channel or server. Ensure the Markdown syntax uses raw characters, not HTML entities. For example, use bold not **bold**. Also verify the webhook URL is correct and the bot has permission to send messages in that channel.

Embed Description Markdown Not Working

Markdown works in the description field of an embed object. However, some Markdown elements like headings and blockquotes may not render as expected inside embeds. Stick to bold, italic, underline, strikethrough, and inline code inside embed descriptions for reliable results.

Line Breaks Not Appearing

In a JSON string, use \n for line breaks. Do not use actual newlines inside the JSON string. Example: "content": "Line one\nLine two". For multi-line content, consider using code blocks with triple backticks.

Special Characters Breaking Markdown

Characters like asterisks, underscores, and backticks inside code blocks or inline code are treated as literal characters and not as formatting. If you need to show an asterisk without formatting, wrap it in backticks: ``.

Markdown Syntax Reference Table

Formatting Syntax Example Output
Bold text text
Italic text text
Bold + Italic text text
Underline __text__ text
Strikethrough ~~text~~ text
Spoiler ||text|| hidden
Inline code `code` code
Code block ```language\ncode\n``` formatted block
Ordered list 1. item numbered list
Unordered list - item bulleted list
Blockquote > text indented quote
Heading 1 # text large heading
Heading 2 ## text medium heading
Heading 3 ### text small heading

You can now format Discord webhook messages with bold, italic, code blocks, lists, and other Markdown elements. Start by testing simple bold text in the content field, then expand to embeds and code blocks. For advanced use, combine Markdown with Discord’s embed objects to create rich, structured notifications. Remember to escape special characters with backticks when you need literal display.