Sooner or later you need to write a character that Markdown wants to interpret — an asterisk that should stay an asterisk, a hash that is not a heading. The answer is a backslash in front of it.
\*this keeps its asterisks\*
*this becomes italic*
\# Not a heading
# An actual heading
2 \* 3 \* 4 = 24
A literal backslash: \\*this keeps its asterisks*
this becomes italic
# Not a heading
An actual heading
2 * 3 * 4 = 24
A literal backslash: \
The rule
A backslash before a Markdown character makes it literal:
\*literal asterisks\**literal asterisks*
A backslash before anything else is just a backslash — \a renders as \a, not as a. That is a useful safety net: escaping too eagerly does not silently swallow your text.
The full list
These are the characters a backslash can escape:
\ backslash ` backtick
* asterisk _ underscore
{ } curly braces [ ] square brackets
< > angle brackets ( ) parentheses
# hash + plus
- minus . period
! exclamation mark | pipe
The pipe is a later addition for tables, but every parser you will meet supports it.
When you do not need it
Most of the time, you do not. Markdown only treats these characters specially in particular positions, so an asterisk in the middle of a sentence is safe:
#only makes a heading at the start of a line. “Issue #42” needs no escape.-only makes a list item at the start of a line, followed by a space. A hyphen inside a word is fine..only matters in1.at the start of a line. “Version 2.0” needs no escape — but “1985. It was a good year” at the start of a line becomes a numbered list, which is what the escape is for.*and_need matching partners. A lone asterisk surrounded by spaces stays an asterisk.
Escape when the output surprises you, not pre-emptively. A paragraph full of backslashes is harder to read than the problem it solves.
Backticks are usually the better answer
For anything that is code — a command, a filename, a variable, a regex — inline code beats escaping. Inside backticks Markdown stops interpreting entirely:
The pattern `^\*+\s` matches leading asterisks.The pattern ^\*+\s matches leading asterisks.
Escaping every character in that pattern would be unreadable and easy to get wrong. See code blocks, including how to show a backtick inside backticks.
Escaping inside tables
A pipe inside a table cell ends the cell, and this is the one place a backslash is needed even inside inline code, because the table is parsed first:
| Command | Meaning |
|---------|---------|
| `a \| b` | pipe a into b || Command | Meaning |
|---|---|
a | b | pipe a into b |
HTML entities
Markdown passes HTML entities through, which sometimes reads better than a backslash:
© 2026 — all rights reserved
<not a tag>© 2026 — all rights reserved <not a tag>
Use < and > for angle brackets around something that looks like a tag: in a renderer that allows raw HTML, <div> in the text would otherwise disappear into the markup.
Common mistakes
Escaping inside a code block. Nothing is interpreted in there, so the backslash renders literally. \* inside backticks shows as \*.
A single backslash at the end of a line. That is a line break, not an escape. To show one literal backslash, write \\.
Escaping an underscore in a URL. Not needed and it can break the link. Wrap awkward URLs in angle brackets instead.
Escaping when backticks would do. If the thing is code, mark it as code.
FAQ
How do I escape a character in Markdown?
Put a backslash before it: \* renders a literal asterisk. This works for the Markdown special characters; before any other character the backslash is shown as itself.
Which characters can be escaped in Markdown?
Backslash, backtick, asterisk, underscore, curly braces, square brackets, parentheses, angle brackets, hash, plus, minus, period, exclamation mark and pipe.
How do I show a literal asterisk in Markdown?
Write \*. In many cases you do not need to — an asterisk that has no matching partner, or one surrounded by spaces, is left alone anyway.
How do I write a backslash in Markdown?
Two of them: \\. A single backslash at the end of a line is interpreted as a line break rather than a literal character.
Do I need to escape characters inside code blocks?
No. Nothing inside inline code or a fenced block is interpreted, so a backslash there renders as a visible backslash. If you need to show code, use backticks rather than escaping character by character.