Skip to content

Markdown cheatsheet

Markdown is a set of conventions for writing formatted text in a plain file, and its appeal is that the source stays readable even when nothing renders it. The syntax below is grouped by what you are trying to do, and each row shows the HTML it actually produces.

Those HTML fragments are not hand-typed. Every one is the real output of this site's own Markdown converter, compared against the table by the test suite on each build — so if a row and the tool ever disagreed, the build would fail rather than the page mislead you.

The dialect is CommonMark plus the GitHub extensions that are near-universal: tables, task lists and strikethrough. Footnotes, definition lists and directives are deliberately absent, because documenting a syntax that then does nothing in the converter one click away is worse than omitting it.

Emphasis and inline code

9

Inline syntax works inside paragraphs, headings, list items and table cells alike.

SyntaxWhat it doesHTML produced
*italic*Italic<p><em>italic</em></p>
_italic_Italic, alternative formIgnored inside a word, so snake_case survives.<p><em>italic</em></p>
**bold**Bold<p><strong>bold</strong></p>
__bold__Bold, alternative form<p><strong>bold</strong></p>
***both***Bold and italic together<p><em><strong>both</strong></em></p>
~~gone~~Strikethrough<p><del>gone</del></p>
`code`Inline code — nothing inside is interpreted<p><code>code</code></p>
``a ` b``Inline code containing a backtickUse more backticks outside than appear inside.<p><code>a ` b</code></p>
\*not italic\*A literal asterisk instead of emphasis<p>*not italic*</p>

Headings

7

The hash form is the one to use; the underline form only reaches two levels.

SyntaxWhat it doesHTML produced
# HeadingLevel 1 heading<h1>Heading</h1>
## HeadingLevel 2 heading<h2>Heading</h2>
### HeadingLevel 3 heading<h3>Heading</h3>
###### HeadingLevel 6 heading — the deepest there is<h6>Heading</h6>
Heading =======Level 1 heading, underlined form<h1>Heading</h1>
Heading -------Level 2 heading, underlined form<h2>Heading</h2>
## Heading ##Trailing hashes are decoration and are droppedThe count on the right is ignored; only the left one sets the level.<h2>Heading</h2>

Lists

7

Indent by two spaces to nest. A blank line between items makes each one a paragraph.

SyntaxWhat it doesHTML produced
- one - twoBulleted list<ul> <li>one</li> <li>two</li> </ul>
* one * twoBulleted list, alternative marker<ul> <li>one</li> <li>two</li> </ul>
1. one 2. twoNumbered list<ol> <li>one</li> <li>two</li> </ol>
1. one 1. twoAlso a numbered list, renumbered on renderOnly the first number is used; the rest can all be 1.<ol> <li>one</li> <li>two</li> </ol>
- one - nestedNested list — indent the child by two spaces<ul> <li>one <ul> <li>nested</li> </ul></li> </ul>
- [ ] todoUnchecked task list item<ul> <li><input type="checkbox" disabled /> todo</li> </ul>
- [x] doneChecked task list item<ul> <li><input type="checkbox" checked disabled /> done</li> </ul>
6
SyntaxWhat it doesHTML produced
[text](https://a.co)Link<p><a href="https://a.co">text</a></p>
[text](https://a.co "Tip")Link with a tooltip title<p><a href="https://a.co" title="Tip">text</a></p>
<https://a.co>Bare URL turned into a link<p><a href="https://a.co">https://a.co</a></p>
[mail](mailto:a@b.co)Email link<p><a href="mailto:a@b.co">mail</a></p>
![alt](cat.png)Image, with alt text<p><img src="cat.png" alt="alt" /></p>
[x](javascript:alert(1))Unsafe scheme — the link is dropped, the text staysjavascript:, data: and vbscript: URLs lose their href.<p>x</p>

Block elements

9

Each of these must start at the beginning of a line.

SyntaxWhat it doesHTML produced
> quotedBlockquote<blockquote> <p>quoted</p> </blockquote>
> > deeperNested blockquote<blockquote> <blockquote> <p>deeper</p> </blockquote> </blockquote>
``` code ```Fenced code block<pre><code>code </code></pre>
```js let a = 1; ```Fenced code block with a language class for highlighting<pre><code class="language-js">let a = 1; </code></pre>
codeCode block by four-space indent<pre><code>code </code></pre>
---Horizontal rule<hr />
***Horizontal rule, alternative form<hr />
one twoLine break inside a paragraphTwo trailing spaces. Invisible in most editors, which is why it so often fails.<p>one<br /> two</p>
one twoA blank line separates paragraphs<p>one</p> <p>two</p>

Tables

4

The delimiter row is what makes it a table. Alignment is set by colons in that row.

SyntaxWhat it doesHTML produced
| a | b | | - | - | | 1 | 2 |Table — header, delimiter row, then body rows
| :--- |Left-align the column, in the delimiter row
| :---: |Centre the column
| ---: |Right-align the column

FAQ

What is the difference between * and _ for emphasis?
Nothing, for the common cases — both produce italic, and doubling either produces bold. The difference only shows up inside a word: snake_case_name is left alone because underscores between word characters are not treated as emphasis, while asterisks would split it. That is why the asterisk form is the safer habit in technical writing.
How do I write a line break without starting a new paragraph?
End the line with two spaces, which becomes a <br />. A blank line instead starts a new paragraph. The two-space rule is invisible in most editors and is the single most common reason a Markdown line break does not appear.
How do I show a literal asterisk or underscore?
Put a backslash before it: \*not italic\*. Inside backticks nothing needs escaping at all, which is usually the better answer when the text is code.
Do Markdown tables need the outer pipes?
No — the leading and trailing pipes are optional, and so is aligning the columns in the source. What is mandatory is the delimiter row of dashes under the header; without it the block is a paragraph containing pipe characters.
Is anything I paste into the converter uploaded?
No. Every tool on this site runs in your browser, and this page has no scripts at all — it is a static table. Nothing you type is sent anywhere, and there is no server to send it to.