Syntax Reference

Markdown Cheat Sheet

This Markdown cheat sheet lists every core syntax element with its HTML output. It covers 9 categories: headings, emphasis, lists, links, images, code, blockquotes, tables, and task lists. Try any example in the converter below.

Input · Markdown
Preview · HTML

Markdown cheat sheet

Bold, italic, and inline code.

  • Bullet item
  1. Numbered item

A blockquote

Link

Headings

Markdown headings use 1 to 6 hash characters. One hash converts to <h1>, two to <h2>, and so on through <h6>. A space must follow the hashes.

Markdown
# H1
## H2
### H3
HTML
<h1>H1</h1>
<h2>H2</h2>
<h3>H3</h3>

Bold and italic

Emphasis uses asterisks. Two asterisks convert to <strong> (bold), one asterisk converts to <em> (italic), and three combine both. Underscores work identically.

Markdown
**bold** *italic* ***both***
HTML
<strong>bold</strong> <em>italic</em> <em><strong>both</strong></em>

Lists

Unordered lists use a hyphen or asterisk and convert to <ul>. Ordered lists use a number and period and convert to <ol>. Indent items by 2 spaces to nest them.

Markdown
- Item
- Item

1. First
2. Second
HTML
<ul><li>Item</li><li>Item</li></ul>
<ol><li>First</li><li>Second</li></ol>

Links and images

Links wrap text in brackets followed by a URL in parentheses, converting to <a>. Images use the same syntax preceded by an exclamation mark, converting to <img> with alt text.

Markdown
[text](https://example.com)
![alt](image.png)
HTML
<a href="https://example.com">text</a>
<img src="image.png" alt="alt">

Code

Inline code uses single backticks and converts to <code>. Fenced code blocks use triple backticks and convert to <pre><code>, with a language label enabling syntax highlighting.

Markdown
`inline`

```js
const x = 1;
```
HTML
<code>inline</code>
<pre><code class="language-js">const x = 1;
</code></pre>

Blockquotes

Blockquotes use a greater-than character at the start of a line and convert to <blockquote>. Stack multiple greater-than characters to nest quotes.

Markdown
> Quoted text
HTML
<blockquote><p>Quoted text</p></blockquote>

Tables (GFM)

Tables are a GitHub Flavoured Markdown feature. Pipes separate columns and a divider row of dashes marks the header, converting to a <table> with <thead> and <tbody>.

Markdown
| A | B |
| --- | --- |
| 1 | 2 |
HTML
<table><thead><tr><th>A</th><th>B</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>

Task lists (GFM)

Task lists are a GitHub Flavoured Markdown feature. The syntax - [x] converts to a checked checkbox input and - [ ] to an unchecked one, each inside a list item.

Markdown
- [x] Done
- [ ] Todo
HTML
<ul><li><input type="checkbox" checked disabled> Done</li><li><input type="checkbox" disabled> Todo</li></ul>

Horizontal rules

Horizontal rules use three or more hyphens, asterisks, or underscores on their own line, converting to an <hr> element that renders a dividing line.

Markdown
---
HTML
<hr>

Frequently Asked Questions

What is Markdown?
Markdown is a lightweight markup language that formats plain text using simple symbols. It converts to HTML, so writers format content without writing HTML tags directly.
What is the difference between Markdown and GitHub Flavoured Markdown?
GitHub Flavoured Markdown extends standard Markdown with tables, task lists, strikethrough, autolinks, and fenced code blocks. The 9 elements in this cheat sheet cover both standard Markdown and the common GFM additions.
Does Markdown support raw HTML?
Yes. Most Markdown parsers pass raw HTML through to the output, so HTML tags written inside a Markdown document render as-is. Some converters sanitise HTML for security.

Related Guides