How to Escape Characters in Markdown
Markdown uses special characters for formatting. Sometimes you need them to appear literally. Here's every way to escape them.
Backslash Escape
Put a backslash \ before any special character:
markdown\*This is not italic\*
\# This is not a heading
\[This is not a link\]
Characters You Can Escape
| Character | Escape | Name |
|---|---|---|
| \ | \ | Backslash |
| ` | ` | Backtick |
| * | * | Asterisk |
| _ | _ | Underscore |
| { } | { } | Curly braces |
| [ ] | [ ] | Square brackets |
| ( ) | ( ) | Parentheses |
| # | # | Hash |
| + - . ! | + - . ! | Misc |
| | |
HTML Entities
| Character | Entity | Use |
|---|---|---|
| & | & | Ampersand |
| < | < | Less than |
| > | > | Greater than |
| © | © | Copyright |
| — | — | Em dash |
| | ||
| Space | | Non-breaking space |
Inside Code Blocks
Characters inside code blocks never need escaping — they're always literal:
markdown
This is bold syntax, not bold text. This is link syntax
Use code blocks when showing markdown syntax examples.
The Pipe in Tables
| is the trickiest — it's the table column separator. To include a literal pipe in a cell:
markdown| Example | Code |
|---------|------|
| Logical OR | `a \| b` |
| Bitwise OR | `a | b` |
Both \| and | work. The HTML entity is more universally supported.
HTML in Markdown
Raw HTML passes through most processors:
markdown<kbd>Ctrl</kbd> + <kbd>S</kbd>
Useful for: keyboard shortcuts (<kbd>), subscript (<sub>), superscript (<sup>), underline (<u>).
Quick Decision Guide
| Situation | Solution |
|---|---|
Literal * | \* |
Literal **bold** | \*\*bold\*\* |
| Pipe in table cell | | |
| Show markdown code | Wrap in code block |
| Keyboard shortcut | <kbd>Ctrl</kbd> |
Test your escaping in MarkGenie's live preview — you'll immediately see if the character is rendering as formatting or literal text.