Markdown reserves a handful of punctuation characters (asterisks, underscores, brackets, backticks) to trigger formatting. That’s a problem the moment you need to write one of those characters literally, like documenting a * wildcard or a [bracket] in a config file. This guide explains the backslash-escape syntax, the full list of escapable characters, and when escaping is, and isn’t, necessary.
Key Takeaways
- Prefix a special character with a backslash (\) to force it to display literally instead of triggering formatting.
- CommonMark defines a fixed list of ASCII punctuation characters that can be escaped; not every character needs one.
- Escaping only matters where the character would otherwise be interpreted as syntax; plain prose text never needs it.
- Inside code spans and fenced code blocks, backslash escapes are ignored, since everything already renders literally.
How Does Backslash Escaping Work in Markdown?
To display a special character literally, place a backslash \ directly in front of it. The parser then treats that character as plain text rather than as formatting syntax.
\*This is not italic\*This renders as:
*This is not italic*
Without the backslashes, the same text would trigger emphasis:
*This is not italic*This is not italic
Which Characters Can Be Escaped?
CommonMark defines a specific set of ASCII punctuation characters that a backslash can escape. Escaping any character outside this list leaves the backslash visible in the output.
\ ` * _ { } [ ] ( ) # + - . ! | \\\* \_ \`: prevents emphasis, bold, and inline code from triggering.\[ \] \( \): prevents link/image syntax from triggering.\#: prevents a line from being parsed as an ATX heading.\- \+ \.: prevents a line from being parsed as a list item.\|: prevents a pipe from being parsed as a table column separator.
\a renders as a literal backslash followed by a (\a). Backslash-escaping only has an effect on the fixed list of ASCII punctuation characters above, never on letters or digits.
How Do I Escape Characters That Start a List or Heading?
A backslash at the start of a line is often necessary to stop Markdown from interpreting ordinary text as structural syntax.
\# Not a heading, just a sentence starting with a hash.
\- Not a list item, just a sentence starting with a dash.
\1. Not a list item either.This renders as plain paragraph text:
# Not a heading, just a sentence starting with a hash. - Not a list item, just a sentence starting with a dash. \1. Not a list item either.
How Do I Escape a Pipe Inside a Table Cell?
Tables use the pipe | character as a column separator, so a literal pipe inside cell content must be escaped or it will be misread as a new column boundary.
| Syntax | Meaning |
| ------ | -------------- |
| `\|` | Escaped pipe || Syntax | Meaning |
|---|---|
| | Escaped pipe |
Do I Need to Escape Characters Inside Code?
No. Inline code spans (single backticks) and fenced code blocks (triple backticks) render their contents literally. Backslashes are never treated as escape characters inside them.
`This *stays* literal, no escaping needed`This *stays* literal, no escaping needed
Only escape a character when it sits in a position where Markdown would otherwise parse it as syntax. Escaping punctuation in ordinary sentences (e.g. Wait\!) adds visible backslashes if the renderer doesn’t strip them, and is unnecessary clutter since most punctuation in running prose is already safe as-is.
Summary Checklist
- Use a backslash (
\) directly before a character to escape it. - Only the fixed CommonMark punctuation list can be escaped, not letters, digits, or arbitrary symbols.
- Escape at the start of a line when text would otherwise be read as a heading or list marker.
- Escape pipes inside table cells to prevent column misalignment.
- Skip escaping entirely inside inline code and fenced code blocks, since it’s unnecessary there.
Frequently Asked Questions
What happens if I escape a character not on the list?
The backslash is printed literally alongside the character (e.g. \a renders as \a), since CommonMark only recognizes the fixed set of escapable punctuation characters.
Can I escape characters inside a link URL?
Yes, but it’s rarely needed. Parentheses inside a URL are the main case, and it’s often clearer to wrap the URL in angle brackets (<url>) instead of escaping individual characters.
Does HTML entity escaping (like &) work the same way?
No, that’s a separate mechanism. HTML entities (&, <, ©) are resolved by the HTML renderer, not by Markdown’s backslash-escape syntax, so both can be used but they solve different problems.
What to Read Next
- Code Blocks in Markdown: Syntax Highlighting Guide — See another place where literal characters render without any escaping needed.
- How to Create Links in Markdown — Learn when escaping matters inside link and reference syntax.
Related Articles
Deepen your understanding with these curated continuations.

Autolinks in Markdown: Bare URLs and Emails
Learn the difference between CommonMark's angle-bracket autolinks and GitHub-Flavored Markdown's extended autolinks for bare URLs and email addresses.

Definition Lists in Markdown
Learn the Markdown Extra-style definition list syntax for terms and descriptions, useful for glossaries and API documentation, plus which tooling supports it.

Beyond GFM: Highlight, Subscript, Superscript & Emoji in Markdown
Learn the non-standard highlight, subscript, superscript, and emoji shortcode syntax some Markdown renderers support, and why they need a plugin to work.


