Home/Docs/Markdown Escaping Characters

Markdown Escaping Characters

Markdown is designed to make writing simple and readable. However, there are times when you want to display Markdown symbols as plain text instead of having them interpreted as formatting. For example, if you type an asterisk (`*`), Markdown may create italic text instead of displaying the asterisk itself. Likewise, a hash symbol (`#`) may become a heading, and square brackets (`[]`) may be treated as part of a link.

This is where **escaping characters** becomes useful. By placing a backslash (`\`) before a special Markdown character, you tell the Markdown parser to display the character exactly as written instead of treating it as Markdown syntax.

In this guide, you'll learn what Markdown escaping characters are, how they work, which characters can be escaped, and how to use them correctly in GitHub, CommonMark, README files, and technical documentation. If you're new to Markdown, start with [Markdown Basics](/markdown-basics) and the [Markdown Syntax](/markdown-syntax) reference before working with escaping characters.

Practice as you read: Open the Markdown Editor to try escaping with live preview, or bookmark the Markdown Cheat Sheet for quick syntax reference.

Open EditorDownload PDF

What Are Markdown Escaping Characters?

Markdown escaping characters allow you to display special Markdown symbols as plain text.

Normally, Markdown interprets certain characters as formatting instructions.

For example:

  • # creates a heading.
  • * creates italic or bold text.
  • [ and ] create links.
  • > creates a blockquote.
  • ` creates inline code.
  • - can create a list.

If you want these characters to appear exactly as they are, you need to escape them.

The most common way to escape a Markdown character is by adding a backslash (\) immediately before it.

For example, instead of writing:

# This becomes a heading

write:

\# This is plain text

Output

Rendered Output

# This is plain text

The backslash tells Markdown not to treat the # as heading syntax.

For a practical introduction to Markdown fundamentals, start with Markdown Basics. For the complete formatting reference, see Markdown Syntax.

Why Use Escaping Characters?

Escaping characters are useful whenever you want to show Markdown syntax instead of using it.

For example, if you're writing a Markdown tutorial, you need to display Markdown symbols without them being converted into headings, lists, or links.

Without escaping:

*italic*

Output

Rendered Output

italic

With escaping:

\*italic\*

Output

Rendered Output

*italic*

This lets readers see the actual Markdown syntax.

Escaping characters are commonly used in:

  • Markdown tutorials
  • Documentation websites
  • GitHub README files
  • Technical documentation
  • Blog posts about Markdown
  • Developer guides
  • Learning resources

How Markdown Escaping Works

Markdown uses several special characters to create formatting.

When you place a backslash (\) before one of these characters, Markdown usually ignores its formatting behavior and displays the character itself.

The basic syntax is very simple.

\special-character

For example:

\#

Output

Rendered Output

#

Another example:

\*

Output

Rendered Output

*

The same rule applies to many other Markdown symbols.

Markdown Escape Syntax

The general syntax for escaping Markdown characters is:

\character

For example:

Markdown Output
\# #
\* *
\[ [
\] ]
\( (
\) )
\> >

This simple backslash is one of the most important tools when writing Markdown documentation.

See the Markdown Cheat Sheet for a quick reference to all common escape sequences.

Characters You Can Escape

Most Markdown parsers allow you to escape commonly used Markdown characters.

Character Purpose in Markdown
\ Escape character
# Heading
* Italic or bold
_ Italic or bold
- List item
+ List item
! Image
[ Link text
] Link text
( Link URL
) Link URL
> Blockquote
` Inline code
Pipe (|) Table separator
. Ordered list
{ } Extended Markdown features
< > HTML tags (depending on the parser)

Not every Markdown implementation supports escaping every character, but these are the most commonly recognized ones.

Markdown Escape Character Cheat Sheet

Bookmark this quick reference when you need to display Markdown symbols as plain text. Prefix any special character with a backslash (\).

Character Escape Syntax
# \#
* \*
_ \_
[ \[
] \]
( \(
) \)
! \!
> \>
` \`
| |

Also commonly escaped: \- (list), \+ (list), \. (ordered list), and \\ (literal backslash).

For a broader syntax lookup, see the Markdown Cheat Sheet. The sections below explain when and how to use each escape in context.

Basic Examples

Escape a Heading

Without escaping:

# Welcome

Output

Rendered Output

Welcome

With escaping:

\# Welcome

Output

Rendered Output

# Welcome


Escape Italic Syntax

Without escaping:

*Markdown*

Output

Rendered Output

Markdown

With escaping:

\*Markdown\*

Output

Rendered Output

*Markdown*


Escape Bold Syntax

\**Important**

Output

Rendered Output

*Important*


Escape a Blockquote

Without escaping:

> This is a quote.

Output

Rendered Output

This is a quote.

With escaping:

\> This is not a blockquote.

Output

Rendered Output

> This is not a blockquote.


Escape Inline Code

Without escaping:

`npm install`

Output

Rendered Output

npm install

With escaping:

\`npm install\`

Output

Rendered Output

`npm install`


Escape a Link

Without escaping:

[MDConvertHub](https://example.com)

Markdown treats this as a hyperlink.

With escaping:

\[MDConvertHub\]\(https://example.com\)

Output

Rendered Output

[MDConvertHub](https://example.com\)

This is useful when you're teaching Markdown syntax and want readers to see the exact markup instead of a clickable link.

Deep dive: Read the complete Markdown Links guide for inline, reference, and relative link syntax.

Escaping Different Markdown Elements

The backslash (\) can be used to escape many Markdown elements. This is especially helpful when you're writing tutorials, documentation, or README files where you need to show Markdown syntax instead of applying it.

Let's look at the most common examples.

Escape Headings

A hash (#) creates a heading in Markdown.

For example:

# Introduction

Output

Rendered Output

Introduction

If you want to display the # character instead of creating a heading, add a backslash before it.

\# Introduction

Output

Rendered Output

# Introduction

This is useful when teaching heading syntax or showing Markdown examples.

Deep dive: Read the complete Markdown Headings guide for hierarchy rules, anchor links, and README structure.

Escape Bold Text

Normally, two asterisks create bold text.

**Important**

Output

Rendered Output

Important

To display the asterisks as plain text, escape them.

\**Important\**

Output

Rendered Output

*Important*

Escape Italic Text

A single asterisk or underscore creates italic text.

*Markdown*

_Markdown_

To show the symbols themselves:

\*Markdown\*

\_Markdown\_

Output

Rendered Output

*Markdown*

_Markdown_

Escape Links

Markdown links use square brackets and parentheses.

[Visit MDConvertHub](https://example.com)

If you're writing a tutorial and want readers to see the actual syntax, escape the special characters.

\[Visit MDConvertHub\]\(https://example.com\)

Output

Rendered Output

[Visit MDConvertHub](https://example.com\)

This is one of the most common uses of escaping in Markdown documentation.

Deep dive: Read the complete Markdown Links guide for inline, reference, and relative link syntax.

Escape Images

Markdown images use almost the same syntax as links.

![Logo](logo.png)

To display the syntax instead of rendering the image:

\!\[Logo\]\(logo.png\)

Output

Rendered Output

![Logo](logo.png)

This is particularly useful when explaining how Markdown images work.

Deep dive: Read the complete Markdown Images guide for syntax, URLs, alt text, and GitHub paths.

Escape Blockquotes

A greater-than sign (>) creates a blockquote.

> This is a quote.

Output

Rendered Output

This is a quote.

To display the > character instead:

\> This is a quote.

Output

Rendered Output

> This is a quote.

Deep dive: Read the complete Markdown Blockquotes guide for syntax, nesting, and GitHub callouts.

Escape Lists

Markdown lists usually begin with:

  • Hyphen (-)
  • Plus (+)
  • Asterisk (*)

Example:

- Apple
- Banana
- Orange

If you want to show the list syntax itself:

\- Apple

\+ Banana

\* Orange

Output

Rendered Output

- Apple

+ Banana

* Orange

Deep dive: Read the complete Markdown Lists guide for ordered, unordered, nested, and task lists.

Escape Ordered Lists

Markdown creates numbered lists automatically.

1. First
2. Second
3. Third

To display the numbering without creating a list:

1\. First

2\. Second

3\. Third

Output

Rendered Output

1. First

2. Second

3. Third

Escaping the period prevents Markdown from treating it as an ordered list.

Escape Inline Code

Backticks create inline code.

`npm install`

To display the backticks:

\`npm install\`

Output

Rendered Output

`npm install`

This is especially useful when teaching Markdown syntax.

Deep dive: Read the complete Markdown Code Blocks guide for fenced blocks, syntax highlighting, and escaping backticks.

Escape Horizontal Rules

Three hyphens create a horizontal line.

---

To display the characters instead:

\-\-\-

Output

Rendered Output

---

Deep dive: Read the complete Markdown Horizontal Rules guide for section dividers with ---, ***, and ___.

Escape Markdown Tables

Table columns are separated by the pipe (|) character.

Example:

| Name | Role |
| ---- | ---- |
| Alex | Developer |

Sometimes you need to display a pipe as plain text.

\|

Output

Rendered Output

|

Some Markdown parsers require different techniques inside tables, so always preview your document if you're displaying literal pipe characters within table cells.

Deep dive: Read the complete Markdown Tables guide for syntax, alignment, and GitHub GFM.

Escape HTML Tags

Markdown allows HTML in many implementations.

For example:

<div>Hello</div>

If you want readers to see the HTML instead of rendering it, escape the angle brackets where supported.

\<div\>Hello\</div\>

Output

Rendered Output

<div>Hello</div>

Depending on the Markdown parser, using HTML entities such as &lt; and &gt; may provide more reliable results than escaping angle brackets.

Deep dive: Read the complete Markdown HTML guide for supported tags, GitHub restrictions, and when to use HTML instead of Markdown.

Markdown Escaping Examples for GitHub

Escaping characters is commonly used in GitHub documentation to explain Markdown syntax.

Deep dive: Read the complete GitHub Markdown guide for README structure, GFM syntax, and GitHub-specific features.

Example 1: Teaching Headings

To create a heading, type:

\# Heading 1

\## Heading 2

\### Heading 3

Readers can see the syntax without GitHub converting it into headings.

Example 2: Teaching Links

Use the following syntax:

\[OpenAI\]\(https://openai.com\)

This displays the Markdown code instead of creating a clickable link.

Example 3: Teaching Images

Insert an image like this:

\!\[Logo\]\(images/logo.png\)

This allows readers to copy the syntax directly.

For GitHub-specific syntax extensions, see GitHub Flavored Markdown.

Markdown Escaping Examples for README Files

README files often explain how to use Markdown.

Example:

## Markdown Example

To make text bold, use:

\**Bold Text\**

To create italic text, use:

\*Italic Text\*

To create a heading, type:

\# Heading

Readers see the exact Markdown syntax rather than formatted text.

Deep dive: Read the complete GitHub Markdown guide for README structure, GFM syntax, and GitHub-specific features.

Markdown Escaping Examples for Documentation

Documentation frequently needs to display commands, formatting rules, and examples.

Example:

### Creating Links

Use this syntax:

\[Link Text\]\(URL\)

Example:

\[MDConvertHub\]\(https://example.com\)

This approach is much easier for readers to follow than screenshots.

For a complete formatting reference, see Markdown Syntax and the Markdown Cheat Sheet.

Markdown Escaping Examples for Technical Writing

Suppose you're writing a guide about Markdown formatting.

### Creating Bold Text

Type:

\**Bold Text\**

### Creating Italic Text

Type:

\*Italic Text\*

### Creating Inline Code

Type:

\`code\`

Because the Markdown characters are escaped, readers can copy the examples exactly as written.

When showing longer syntax examples, consider using Markdown Code Blocks instead of escaping every character.

When Should You Escape Characters?

Escaping characters is useful whenever you need to display Markdown syntax instead of using it.

Common situations include:

  • Writing Markdown tutorials
  • Creating documentation websites
  • Explaining Markdown syntax
  • Writing developer guides
  • Creating learning resources
  • Showing README examples
  • Teaching beginners
  • Displaying Markdown code inside articles

If your goal is to help readers learn Markdown, escaping characters is one of the most important techniques you'll use.

For quick syntax lookup while writing, keep the Markdown Cheat Sheet nearby.

CommonMark Compatibility

Markdown escaping is part of the CommonMark specification, and most Markdown parsers support escaping special characters with a backslash (\).

For example:

\# Heading

Output

Rendered Output

# Heading

This displays the # character instead of creating a heading.

However, not every character behaves the same way in every Markdown application. Some extended Markdown features, such as tables or task lists, may have slightly different behavior depending on the parser.

If you're creating documentation for multiple platforms, always preview your Markdown to ensure it renders as expected.

GitHub Flavored Markdown is based on CommonMark while adding GitHub-specific extensions such as tables and task lists.

Platform Compatibility

The following table shows how escaping characters are generally supported across popular Markdown platforms.

Platform Backslash Escaping Notes
GitHub βœ… Supported Supports CommonMark and GitHub Flavored Markdown
GitLab βœ… Supported Works similarly to GitHub
VS Code Markdown Preview βœ… Supported Displays escaped characters correctly
Obsidian βœ… Supported Works in preview mode
CommonMark βœ… Supported Standard behavior
Stack Overflow βœ… Supported Useful when posting Markdown examples
Markdown editors βœ… Supported Supported by most modern editors

Although escaping is widely supported, some applications include additional Markdown extensions. Always test your document if you're using platform-specific features.

Best Practices

Escaping characters is simple, but following a few best practices will make your Markdown easier to read and maintain.

Escape Only When Necessary

Only escape characters that would otherwise be interpreted as Markdown syntax.

Good example:

Use \# to display a hash symbol.

Avoid adding unnecessary backslashes to normal text.

Poor example:

T\h\i\s \i\s \u\n\n\e\c\e\s\s\a\r\y.

Too many backslashes make Markdown difficult to read.

Use Code Blocks for Longer Examples

If you're showing multiple lines of Markdown syntax, a fenced code block is usually a better choice than escaping every character.

Instead of writing:

\# Heading

\## Subheading

\*\*Bold Text\*\*

Write:

```markdown
# Heading

## Subheading

**Bold Text**
```

Code blocks are cleaner, easier to read, and easier for readers to copy.

See Markdown Code Blocks for fenced block syntax and language tags.

Keep Examples Practical

Show examples that readers are likely to use in real projects.

Instead of:

\# Test

Use:

\# Installation

\## Getting Started

\## Configuration

Realistic examples are more helpful and easier to understand.

Preview Your Markdown

Different applications may render certain characters differently.

Before publishing your documentation, preview it to ensure everything displays correctly.

This is especially important when using:

  • Tables
  • HTML
  • Extended Markdown syntax
  • Platform-specific features

Open the Markdown Editor to verify rendering before you publish.

Explain Why You're Escaping Characters

If you're teaching Markdown, don't just show the syntax. Explain why escaping is needed.

For example:

We add a backslash before the # character so Markdown displays it as plain text instead of creating a heading.

A short explanation helps beginners understand the concept more quickly.

Common Mistakes

Even experienced Markdown users sometimes make mistakes when escaping characters.

Here are some of the most common ones.

Forgetting the Backslash

Without the backslash, Markdown applies formatting instead of displaying the character.

Incorrect:

# Installation

This creates a heading.

Correct:

\# Installation

This displays the heading syntax as plain text.

Escaping Characters That Don't Need Escaping

Not every character needs a backslash.

Incorrect:

H\ello W\orld

Correct:

Hello World

Only escape special Markdown characters.

Escaping an Entire Paragraph

Some beginners place a backslash before every word or symbol.

Example:

\This \is \not \necessary.

Markdown becomes harder to read and maintain.

Only escape the characters that have special meaning.

Using Escaping Instead of Code Blocks

If you're explaining several lines of Markdown syntax, a code block is usually the better solution.

Instead of escaping every character:

\# Heading

\## Heading Two

\*\*Bold\*\*

Use:

```markdown
# Heading

## Heading Two

**Bold**
```

Readers can copy the code directly without removing backslashes.

Assuming Every Markdown Parser Behaves the Same

Most Markdown parsers follow CommonMark, but some include additional features.

For example:

  • GitHub Flavored Markdown
  • GitLab Flavored Markdown
  • Obsidian
  • Notion

If you're writing documentation for multiple platforms, always verify how your examples render.

Real-World Examples

Example 1: Markdown Tutorial

When teaching headings, you want readers to see the syntax instead of creating actual headings.

To create a level-one heading, type:

\# My Heading

This makes the tutorial much easier to follow.

Example 2: Developer Documentation

Suppose you're documenting Markdown formatting.

To create bold text, type:

\**Important\**

Readers can copy the syntax exactly as shown.

Example 3: GitHub README Guide

README files often include Markdown examples.

### Creating a Link

Use:

\[GitHub\]\(https://github.com\)

The syntax is displayed instead of becoming a clickable link.

Example 4: Blog Tutorial

Technical blog posts frequently explain Markdown features.

Use the following syntax for italic text:

\*Italic Text\*

Escaping ensures readers see the actual Markdown syntax.

Example 5: Learning Resources

Educational websites commonly show Markdown examples using escaping or fenced code blocks.

\# Heading

\## Subheading

\*Italic Text\*

\**Bold Text**

This helps beginners understand exactly what they need to type.

Practice Markdown Escaping Characters

The best way to learn Markdown escaping is by writing it yourself.

Open the Markdown Editor to experiment with backslash escaping while previewing the rendered output in real time. Keep the Markdown Cheat Sheet nearby for quick syntax lookup.

Try building a short document that includes:

  • Escaped heading syntax such as \# Installation
  • Escaped bold and italic examples
  • Escaped link syntax showing brackets and parentheses
  • A comparison between formatted output and escaped literal syntax
  • A fenced code block for a multi-line Markdown example
  • A preview check in the editor before publishing

Summary

Escaping characters is an essential Markdown skill that allows you to display Markdown syntax as plain text.

In this guide, you learned:

  • What Markdown escaping characters are
  • How backslash escaping works
  • Which Markdown characters can be escaped
  • How to escape headings, links, images, lists, blockquotes, and inline code
  • The difference between escaping characters and using code blocks
  • CommonMark and GitHub compatibility
  • Best practices for writing clear documentation
  • Common mistakes to avoid
  • Practical examples for tutorials, README files, and technical documentation
  • Frequently asked questions

Although escaping characters is a small feature, it's incredibly useful when creating Markdown tutorials, documentation websites, or developer resources. Knowing when to escape a characterβ€”and when to use a code block insteadβ€”will help you write clearer, more professional Markdown documents.

Continue Learning

Continue learning Markdown with these guides:

Available now

Coming soon

The best way to learn Markdown escaping is by writing it yourself. Open the Markdown Editor to experiment with escaping while previewing the rendered output in real time.

Frequently Asked Questions

  1. 1

    What are Markdown escaping characters?

    Markdown escaping characters allow you to display special Markdown symbols as plain text instead of having them interpreted as formatting. The most common way to escape a character is by placing a backslash (\) before it. For example, \# This is plain text displays the # character instead of creating a heading.

  2. 2

    How do you escape characters in Markdown?

    Use a backslash (\) immediately before the special character. For example, \* displays * and \[ displays [. This method works for most Markdown special characters.

  3. 3

    Why is the backslash used in Markdown?

    The backslash tells the Markdown parser to treat the next character as plain text instead of Markdown formatting. Without escaping, # Heading creates a heading. With escaping, \# Heading displays the hash symbol as plain text.

  4. 4

    Which Markdown characters can be escaped?

    Most Markdown parsers allow you to escape characters such as #, *, _, [, ], (, ), !, >, backticks, |, +, -, and . These are the characters most commonly used in Markdown formatting.

  5. 5

    Does GitHub support escaping characters?

    Yes. GitHub Flavored Markdown supports backslash escaping for Markdown syntax. For example, \# Heading, \*Italic\*, and \[Link Text\]\(URL\) display as plain text instead of applying Markdown formatting.

  6. 6

    Does CommonMark support escaping?

    Yes. Backslash escaping is part of the CommonMark specification. Most CommonMark-compatible Markdown parsers support escaping the standard Markdown characters.

  7. 7

    Should I use escaping or code blocks?

    Use escaping when you're showing a few Markdown characters inside a sentence, such as Use \# to display a hash symbol. Use a code block when you're showing multiple lines of Markdown syntax. For tutorials and documentation, code blocks are usually easier to read.

  8. 8

    Why isn't my escaped character working?

    There are several possible reasons: the character may not need escaping, your Markdown application may handle that character differently, you're using a Markdown extension with different parsing rules, or the document hasn't been rendered by a Markdown parser yet. If you're unsure, preview your document in the application where it will be published.

  9. 9

    Can I escape characters inside Markdown tables?

    Yes, but support varies depending on the Markdown parser. Escaping works for many characters, but the pipe (|) inside table cells may require additional handling in some applications. Always preview tables before publishing to ensure they render correctly.

  10. 10

    When should I escape Markdown characters?

    Escape characters whenever you want readers to see the Markdown syntax instead of formatted output. Common situations include writing Markdown tutorials, creating documentation, explaining Markdown syntax, publishing developer guides, writing GitHub README files, and teaching beginners.