Markdown Cheatsheet

Complete syntax reference for Markdown. Use with our Markdown to HTML converter to try each example with live preview.

1. Headings

Headings define the outline of your document. You can create up to six levels of headings. There are two styles: ATX-style (using # at the start of the line) and Setext-style (using underlines for the first two levels only). Most Markdown processors support both; ATX is more common and works everywhere.

ATX-style headings (recommended)

Place one to six hash characters at the beginning of a line, followed by a space, then the heading text. Closing hashes are optional and are often omitted.

# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6

# Heading with closing hashes #

Output

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5
Heading level 6

Heading with closing hashes

Setext-style headings (H1 and H2 only)

For level 1, underline the text with any number of =. For level 2, use -. The underline must be on the line immediately after the text.

Heading level 1
================

Heading level 2
----------------

Output

Heading level 1

Heading level 2

2. Paragraphs and line breaks

A paragraph is one or more consecutive lines of text separated by one or more blank lines. Do not indent paragraphs with spaces or tabs (that creates a code block). To create a line break without starting a new paragraph, end a line with two or more spaces, then press Enter. Some processors also treat a single newline as a break (depending on the implementation).

This is the first paragraph. It can
span multiple lines in the source, but
it will still be one paragraph.

This is the second paragraph. A blank
line separates paragraphs.

To force a line break inside a paragraph,  
end the line with two spaces.

Output

This is the first paragraph. It can span multiple lines in the source, but it will still be one paragraph.

This is the second paragraph. A blank line separates paragraphs.

To force a line break inside a paragraph,
end the line with two spaces.

3. Bold, italic, and strikethrough

Emphasis is added with asterisks * or underscores _. One delimiter for italic, two for bold. Strikethrough uses two tildes ~~ (supported in many extended Markdown flavors, including GitHub and Showdown). You can combine bold and italic with three delimiters.

Syntax Result
*italic* or _italic_italic
**bold** or __bold__bold
***bold italic***bold italic
~~strikethrough~~strikethrough

Word boundaries: Use asterisks when the emphasis is inside a word (e.g. un*fancy*). Underscores can be interpreted as emphasis only when they are not part of a word; otherwise they may be left literal (e.g. snake_case might stay as-is in some parsers).

4. Lists

Markdown supports unordered and ordered lists. For unordered lists, use -, *, or + followed by a space. For ordered lists, use a number followed by a period and a space (the actual number is ignored; output is always 1, 2, 3…). To nest lists, indent the nested items by two or four spaces.

Unordered list

- First item
- Second item
- Third item
  - Indented item (nested)
  - Another nested item
- Back to top level

Output

  • First item
  • Second item
  • Third item
    • Indented item (nested)
    • Another nested item
  • Back to top level

Ordered list

You can use 1. for every item; the HTML output will still be 1, 2, 3. This makes reordering in source easier.

1. First item
2. Second item
3. Third item
   1. Nested ordered item
   2. Another nested item
4. Fourth item

Output

  1. First item
  2. Second item
  3. Third item
    1. Nested ordered item
    2. Another nested item
  4. Fourth item

List items with multiple paragraphs

Indent the continuation paragraph by four spaces (or one tab) so it stays part of the same list item.

- First item

  This is a second paragraph under the first item.  
  It is indented to align with the content above.

- Second item

Output

  • First item

    This is a second paragraph under the first item. It is indented to align with the content above.

  • Second item

5. Links

Links are written as [link text](URL). You can add an optional title (tooltip) with a space and a quoted string after the URL. Reference-style links let you define the URL once and reuse it: use [text][label] and elsewhere [label]: URL. Raw URLs in angle brackets become links automatically in many processors.

Inline link

[ConvertLoom](https://www.convertloom.com)

[Markdown to HTML](https://www.convertloom.com/tools/markdown-to-html "Free converter")

Output

Reference-style link

Use the [Markdown converter][converter] for live preview.

[converter]: https://www.convertloom.com/tools/markdown-to-html
[converter]: https://www.convertloom.com/tools/markdown-to-html "Optional title"

URLs and email addresses

Many Markdown processors turn URLs and emails in angle brackets into links automatically.

<https://www.convertloom.com>
<[email protected]>

Output

Use the Markdown converter for live preview.

Angle brackets: https://www.convertloom.com, [email protected]

6. Images

Image syntax is like link syntax, but with an exclamation mark ! before the square brackets: ![alt text](image-url). The alt text is required for accessibility and is shown when the image cannot be loaded. You can add an optional title in quotes after the URL. Reference-style images work the same as reference-style links: ![alt][ref] and [ref]: url.

![Logo](https://example.com/logo.png)
![Logo with title](https://example.com/logo.png "Company logo")

![Reference-style][logo]
[logo]: https://example.com/logo.png

Output

Renders an <img> with alt "Logo": 🖼 Logo

Reference-style produces the same: image with alt text, optional title on hover.

7. Code

Inline code is wrapped in single backticks: `code`. To include a literal backtick inside inline code, use double backticks: `` `code` ``. Code blocks can be fenced with three backticks (or three tildes) on the line before and after the code; optionally add a language identifier for syntax highlighting. Alternatively, indent every line of the block by four spaces or one tab (indented code blocks).

Inline code

Use the `markdown to html` converter. The `<pre>` tag preserves formatting.
To show a backtick: `` `inline` ``

Output

Use the markdown to html converter. The <pre> tag preserves formatting. To show a backtick: `inline`

Fenced code block (with language)

```javascript
function greet(name) {
  return "Hello, " + name + "!";
}
greet("World");
```

Output

function greet(name) {
  return "Hello, " + name + "!";
}
greet("World");

Indented code block

Indent at least four spaces (or one tab). Stops at the first line that is not indented.

    This line is indented with four spaces.
    So is this one.
    Together they form a code block.

Output

This line is indented with four spaces.
So is this one.
Together they form a code block.

8. Tables

Tables use pipes | to separate columns. The first row is the header; the second row is a delimiter row containing only -, :, and pipes. Colons in the delimiter row set alignment: :--- left, ---: right, :---: center. To use a literal pipe in a cell, escape it with a backslash: \|.

| Syntax      | Description |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |

| Left-aligned | Center-aligned | Right-aligned |
| :----------- | :------------: | ------------: |
| left         | center        | right         |

Output

SyntaxDescription
HeaderTitle
ParagraphText

With alignment: left | center | right columns.

9. Blockquotes

Start a line with > to create a blockquote. You can put > on every line or only the first (many processors allow lazy continuation). Use >> for nested blockquotes. Blockquotes can contain other block elements (headings, lists, code blocks) as long as they are also prefixed with >.

> This is a blockquote. It can span
> multiple lines.

> Single line blockquote.

> Nested blockquote:
> > Inner quote.

Output

This is a blockquote. It can span multiple lines.

Single line blockquote.

Nested blockquote:

Inner quote.

10. Horizontal rules

A line containing only three or more *, -, or _ (with optional spaces between them) produces a horizontal rule. Put a blank line before and after so it is not interpreted as a Setext heading or list.

---

***

* * *

_____

Output





11. Task lists (checkboxes)

Many extended Markdown flavors (e.g. GitHub, Showdown) support task lists. Write a list item that starts with - [ ] for an unchecked box or - [x] (or - [X]) for a checked box. The space inside the brackets is required for unchecked; x or X for checked.

- [ ] Unchecked task
- [x] Checked task
- [X] Also checked (capital X)

Output

  • Unchecked task
  • Checked task
  • Also checked (capital X)

12. Escaping with backslash

Use a backslash \ before a character to use it literally instead of as Markdown. Escapable characters include: \ ` * _ { } [ ] ( ) # + - . ! |

\* Not italic
\# Not a heading
\[not a link](url)
Escaped backslash: \\

Output

* Not italic

# Not a heading

[not a link](url)

Escaped backslash: \