MDConverter
Universal In-Browser Converter
100% Client-Side Private

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

Escaped Markdown
\# 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.

Markdown
\*This is not italic\*

\# This is not a heading

1986\. A great year — not a numbered list.

Price: 5 \* 3 \= 15
Result

*This is not italic*

# This is not a heading

1986. A great year — not a numbered list.

Price: 5 * 3 = 15

Escaping = 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 **kwargs and #include need no escapes.
  • Symbols surrounded by spaces. 5 * 3 and a - b are not emphasis or bullets.
  • Underscores inside words. snake_case_name stays as written in CommonMark and GitHub.
  • # without a following space. #hashtag is 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.

Markdown
| Operator | Meaning |
| --- | --- |
| `a \|\| b` | logical OR |
| \| | pipe character |
Result
Operator Meaning
a || b logical OR
| pipe character
More table-specific cases are covered on MarkdownTables.com: escaping pipes in Markdown tables.

HTML entities as an alternative

Where HTML is allowed, character references also work and are sometimes clearer: &#42; for *, &#95; for _, &#124; for |, &lt; for <, &amp; for &, &nbsp; 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

ProblemFix
The backslash shows in the outputYou 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 backslashesEscape each backslash (C:\\Users) or put the path in backticks: C:\Users.
Escape ignored in Slack or DiscordChat apps implement their own subset; Discord supports \*, Slack does not support backslash escapes reliably.

Tools for this

Frequently Asked Questions

Frequently Asked Questions About Escaping special characters

Comprehensive answers to common technical, formatting, security, and compatibility questions.

Escape it with a backslash (\*), put spaces around it (5 * 3), or wrap it in backticks as code. Any of the three shows a literal asterisk.

Sources

← All Markdown lessons · Markdown cheat sheet