Skip to content
Back to Journal
GuideMay 5, 2026·2 min read

How to Escape Special Characters in Markdown

Display literal asterisks, hashes, backticks, and other special characters in markdown using the backslash escape.

The quick answer: Put a backslash before a special character to display it literally instead of as markdown formatting.

The Escape Character

The backslash tells markdown to treat the next character as plain text rather than syntax:

  • \ renders as (not bold or italic)
  • \# renders as # (not a heading)
  • \[ renders as [ (not a link)
  • A backtick — use double backticks as the delimiter for your code span

Characters That Need Escaping

These characters have special meaning in markdown and may need a backslash: \ ` * _ { } [ ] ( ) # + - . ! |

Context matters — a # only needs escaping at the start of a line (where it would become a heading). Mid-sentence, # renders literally without escaping.

Common Use Cases

Showing asterisks: write \not bold\ to render not bold with literal asterisks. Literal hash at start of line: write \# Not a heading to render # Not a heading. Pipe in table cell: use \| when your table cell content contains a pipe character.

Code Blocks Are an Escape-Free Zone

You never need to escape characters inside backtick code spans or fenced code blocks. Content there is always displayed verbatim.

Showing a Literal Backslash

To display a backslash, escape it: write two backslashes — the first one escapes the second, and you get a single backslash in the output.


Full reference: Markdown Escape Characters.

MT

MarkdownTools Team

May 5, 2026

Try it free

Make your AI output beautiful

Paste markdown from ChatGPT or Claude. Pick a theme. Export as PDF or HTML in seconds.

Open App — It's Free