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.
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.
# H1
## H2
### H3<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.
**bold** *italic* ***both***<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.
- Item
- Item
1. First
2. Second<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.
[text](https://example.com)
<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.
`inline`
```js
const x = 1;
```<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.
> Quoted text<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>.
| A | B |
| --- | --- |
| 1 | 2 |<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.
- [x] Done
- [ ] Todo<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.
---<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.