Markdown Escape Characters: How to Show *, _, # and | Literally
By the MDConverter team · Updated · 3 min read
Quick answer
Put a backslash (\) in front of a character to make Markdown show it literally: \*not italic\* renders as not italic with the asterisks visible. Any ASCII punctuation character can be escaped, and inside code nothing needs escaping at all. Use the tool below to escape a whole piece of text at once, or to remove escapes from text you copied.
Markdown escape tool
\# Price: $5 \*each\* — 50% off\_today\_ \| 1. Not a list
Runs in your browser. “Only what is needed” escapes characters that would change the formatting where they are; “Every symbol” escapes all Markdown punctuation.
Escaping with a backslash
A backslash before a punctuation character turns off its Markdown meaning. The backslash itself disappears from the output.
\*This is not italic\*
\# This is not a heading
1986\. A great year — not a numbered list.
Price: 5 \* 3 \= 15*This is not italic*
# This is not a heading
1986. A great year — not a numbered list.
Price: 5 * 3 = 15
= is harmless even though it rarely needs it — unnecessary escapes still render correctly.Characters you can escape
CommonMark allows a backslash before any ASCII punctuation character. These are the ones that matter in practice:
| Character | Name | Why it may need escaping |
|---|---|---|
\ |
backslash | Starts an escape itself |
` |
backtick | Starts inline code |
* |
asterisk | Bold, italic, bullet |
_ |
underscore | Bold, italic (at word boundaries) |
{ } |
curly braces | Attribute syntax in some renderers |
[ ] |
square brackets | Links, images, task lists |
( ) |
parentheses | Link URLs |
# |
hash | Heading at the start of a line |
+ - |
plus, minus | Bullets at the start of a line; --- rules |
. |
dot | 1. numbered list at the start of a line |
! |
exclamation mark | ![ starts an image |
| |
pipe | Table column separator (inside a table, even code needs |) |
~ |
tilde | Strikethrough, code fences |
< > |
angle brackets | HTML tags, autolinks, > quotes |
Letters, digits and non-ASCII characters cannot be escaped — a backslash before them is shown as a normal backslash.
When you do not need to escape
- Inside code. Text in backticks or a code block is never interpreted, so
**kwargsand#includeneed no escapes. - Symbols surrounded by spaces.
5 * 3anda - bare not emphasis or bullets. - Underscores inside words.
snake_case_namestays as written in CommonMark and GitHub. #without a following space.#hashtagis not a heading.
Escaping a pipe inside a table
In a table cell, | ends the cell, so write \| instead. On GitHub this works even inside inline code in a table.
| Operator | Meaning |
| --- | --- |
| `a \|\| b` | logical OR |
| \| | pipe character || Operator | Meaning |
|---|---|
a || b |
logical OR |
| | | pipe character |
HTML entities as an alternative
Where HTML is allowed, character references also work and are sometimes clearer: * for *, _ for _, | for |, < for <, & for &, for a non-breaking space.
Seeing backslashes in copied AI text?
Text copied from ChatGPT, Notion exports or some converters sometimes contains escapes such as \* or \_ that show up in plain-text apps. Paste it into the tool above and choose Remove escapes, or run it through Remove asterisks from ChatGPT text, which removes escapes along with the rest of the Markdown.
Common mistakes and how to fix them
| Problem | Fix |
|---|---|
| The backslash shows in the output | You escaped a character that cannot be escaped (a letter or digit), or the text is inside code where escapes are not processed. |
| A Windows path lost its backslashes | Escape each backslash (C:\\Users) or put the path in backticks: C:\Users. |
| Escape ignored in Slack or Discord | Chat apps implement their own subset; Discord supports \*, Slack does not support backslash escapes reliably. |
Tools for this
Frequently Asked Questions About Escaping special characters
Comprehensive answers to common technical, formatting, security, and compatibility questions.
Related reading
- Markdown Text Formatting: Bold, Italic, Strikethrough and More — Bold, italic, strikethrough, underline, highlight, superscript and subscript — with app support.
- Markdown Code Blocks: Inline Code, Fences and Syntax Highlighting — Inline code, fenced blocks, language names for highlighting, diffs and nested backticks.
- How to Write Comments in Markdown — Leave notes in a Markdown file that never appear on the rendered page.