The Complete Markdown Cheat Sheet

Every Markdown syntax on one page, shown twice: what you type and what you get. Copy any example straight into your document, or test it in the live preview. Verified against the CommonMark Spec, John Gruber’s original design, and the GitHub Flavored Markdown Spec. Last verified: 2026-07-07.

Markdown is a lightweight markup language that formats plain text using ordinary keyboard characters: # for headings, **asterisks** for bold, - for lists. A Markdown file stays readable as raw text and renders as clean HTML everywhere: GitHub READMEs, documentation sites, note apps like Obsidian, and AI tools, which use Markdown as their default output format.

The basics take about 20 minutes to learn. This page is built for the part that comes after: quickly looking up the syntax you forgot. Every example below is a pair: the raw Markdown on the left (You type), and the rendered result on the right (You get). Copy any example and paste it into the free live Markdown preview to experiment with it.

Everything here works in any CommonMark-compliant app. Elements that come from GitHub Flavored Markdown are marked GFM. They work on GitHub, GitLab, and most modern tools, but not in strictly minimal renderers.

Quick Reference

The condensed version: all common Markdown syntax in one table. Each element links to its full section with rules, edge cases, and extra examples.

Element You type You get
Bold **bold text**
bold text
Italic *italic text*
italic text
Strikethrough ~~mistake~~
mistake
Heading # Heading 1 ## Heading 2
Heading 1
Heading 2
Link [title](https://example.com)
Image ![alt text](image.png)
the image, with alt text
Inline code `code`
code
Code block ```python print("hi") ```
print("hi")
Unordered list - First item - Second item
  • First item
  • Second item
Ordered list 1. First item 2. Second item
  1. First item
  2. Second item
Task list - [x] Done - [ ] To do
  • Done
  • To do
Blockquote > a quote

a quote

Table | Col 1 | Col 2 | | ----- | ----- | | Text | Text |
Col 1Col 2
TextText
Horizontal rule ---

Escape a character \*not italic\*
*not italic*

Want to see any of these live? Paste them into the Markdown preview and they render instantly, right in your browser.

Headings

Create a heading by starting a line with # characters: one # for the largest heading (level 1), down to six (######) for the smallest. Put a space between the last # and your text: CommonMark requires it, and #Heading without the space won’t render.

You type
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
You get
Heading 1
Heading 2
Heading 3
Heading 4

Levels 1 and 2 have an alternative “underline” style (called setext headings): put any number of = signs on the line below the text for level 1, or - signs for level 2.

You type
Heading 1
=========

Heading 2
---------
You get
Heading 1
Heading 2

Tip: Use exactly one level-1 heading per document and don’t skip levels (H2 → H4). It renders fine, but it hurts document structure. Our Markdown validator flags both automatically.

Paragraphs & Line Breaks

A paragraph is one or more consecutive lines of text separated from the next paragraph by a blank line. A single newline does not break the line, so adjacent lines join into one paragraph.

You type
This line and
this line join into one paragraph.

A blank line starts a new paragraph.
You get

This line and this line join into one paragraph.

A blank line starts a new paragraph.

To force a line break inside a paragraph, end the line with two or more spaces, or with a backslash (\).

You type
Roses are red  
Violets are blue
You get

Roses are red
Violets are blue

Note: GitHub is a special case: in issues, pull requests, and discussions a single newline does render as a line break, but in .md files (like your README) it does not. When in doubt, use trailing spaces, a backslash, or a <br> tag.

Bold, Italic & Strikethrough

Wrap text in single asterisks or underscores for italic, double for bold, and triple for bold italic. Asterisks and underscores are interchangeable. Just open and close with the same character.

You type
*italic* or _italic_

**bold** or __bold__

***bold italic*** or ___bold italic___
You get

italic or italic

bold or bold

bold italic or bold italic

Strikethrough GFM wraps text in double tildes (GitHub also accepts single tildes).

You type
The deadline is ~~Friday~~ Monday.
You get

The deadline is Friday Monday.

Note: To emphasize part of a word (like the middle of “unbelievable”), use asterisks: un*believ*able. Underscores inside words are treated as literal characters, so snake_case_names render safely without surprise italics.

Lists

For a bulleted (unordered) list, start each line with -, *, or + followed by a space. All three markers work identically. Just be consistent within one list.

You type
- First item
- Second item
- Third item
You get
  • First item
  • Second item
  • Third item

For a numbered (ordered) list, start each line with a number and a period. The numbers you type don’t have to be right because renderers count for you. Only the first number matters: it sets where the list starts.

You type
1. First item
1. Second item
1. Third item
You get
  1. First item
  2. Second item
  3. Third item

To nest a list inside another, indent the nested items until they line up with the first character of the parent item’s text (two spaces for - lists, three for 1. lists).

You type
1. First item
2. Second item
   - Nested item
   - Another nested item
3. Third item
You get
  1. First item
  2. Second item
    • Nested item
    • Another nested item
  3. Third item

Tip: A list must be separated from the paragraph above it by a blank line in many renderers. If your list renders as one run-on sentence, a missing blank line is almost always the cause.

Task Lists GFM

A task list renders as clickable checkboxes. Write a normal list, then put [ ] (with a space) for an open task or [x] for a completed one right after the marker.

You type
- [x] Write the report
- [x] Review the numbers
- [ ] Send it to the team
You get
  • Write the report
  • Review the numbers
  • Send it to the team

Note: Task lists are a GitHub Flavored Markdown extension. They work on GitHub, GitLab, Obsidian, and most modern editors, but plain CommonMark renderers show them as literal text.

Images

An image is a link with an exclamation mark in front. The text in brackets becomes the alt text, shown when the image can’t load and read by screen readers, so make it descriptive.

You type
![A red heart logo](/apple-icon-60x60.png)
You get

A red heart logo

To make the image itself clickable, wrap the whole image syntax in a link:

You type
[![A red heart logo](/apple-icon-60x60.png)](https://ilovemardown.com)
You get

A red heart logo

Note: Markdown has no syntax for image size. Attempts like =300x200 or {width=300} are extensions that only work in specific apps. The portable fix is an HTML tag: <img src="image.png" alt="description" width="400">. This is what works on GitHub.

Blockquotes

Start a line with > to quote it. For a multi-paragraph quote, put > at the start of every line, including a > on the blank line between paragraphs.

You type
> Markdown is intended to be as easy-to-read
> and easy-to-write as is feasible.
>
> — John Gruber
You get

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

— John Gruber

Blockquotes nest with additional > characters, and they can contain any other Markdown: headings, lists, code, even tables.

You type
> The reviewer said:
>
> > Ship it.
You get

The reviewer said:

Ship it.

Code

For a short snippet inside a sentence (inline code), wrap it in single backticks. Nothing inside is interpreted as Markdown.

You type
Run `npm install` before starting.
You get

Run npm install before starting.

For multi-line code, use a fenced code block: a line of three backticks before and after. Add a language name after the opening fence to get syntax highlighting on GitHub and most renderers.

You type
```python
def greet(name):
    return f"Hello, {name}!"
```
You get
def greet(name):
    return f"Hello, {name}!"

Tip: Need a backtick inside inline code? Use double backticks around it: `` code with a ` backtick ``. Need a code fence inside a code block (like when documenting Markdown itself)? Use four backticks for the outer fence.

Tables GFM

Build a table with pipes (|) between columns and a divider row of dashes under the header. The divider row is mandatory: without it, nothing renders as a table. The pipes don’t need to line up perfectly. Messy columns render the same.

You type
| Syntax | Description |
| ------ | ----------- |
| Header | Title       |
| List   | Element     |
You get
SyntaxDescription
HeaderTitle
ListElement

Align columns with colons in the divider row: :--- for left, :---: for center, ---: for right.

You type
| Left | Center | Right |
| :--- | :----: | ----: |
| a    | b      | c     |
You get
LeftCenterRight
abc

Two things Markdown tables can’t do natively, and their standard workarounds:

You type
| Multi-line cell            | Pipe in cell   |
| -------------------------- | -------------- |
| First line<br>Second line  | escape it: \| |
You get
Multi-line cellPipe in cell
First line
Second line
escape it: |

Note: Line breaks inside a cell require the HTML tag <br>, and a literal pipe must be escaped as \|. For anything more complex (merged cells, no header row), switch to an HTML <table>. Tables are also the syntax people mistype most, so preview your table live before you publish it.

Horizontal Rules

Create a horizontal divider line with three or more hyphens, asterisks, or underscores alone on a line.

You type
Above the line.

---

Below the line.
You get

Above the line.


Below the line.

Note: Keep a blank line before a --- divider. Placed directly under a line of text, the dashes turn that text into a level-2 heading instead (the setext syntax from the Headings section).

Escaping Characters

To display a character that Markdown would otherwise interpret (a literal asterisk, underscore, or hash), put a backslash (\) in front of it. In CommonMark, a backslash escapes any ASCII punctuation character.

You type
\*This is not italic\* and this is not a heading: \# hello
You get

*This is not italic* and this is not a heading: # hello

The characters you’ll escape most often: \ ` * _ { } [ ] ( ) # + - . ! |

GitHub Extras GFM

These elements work on github.com (READMEs, issues, pull requests, discussions). Support elsewhere varies, so test before relying on them outside GitHub.

Footnotes

Add a reference marker like [^1] in the text, then define it anywhere in the document. GitHub collects footnotes at the bottom of the page and links them both ways.

You type
Markdown was created in 2004.[^1]

[^1]: By John Gruber, with Aaron Swartz.
You get

Markdown was created in 2004.1


1 By John Gruber, with Aaron Swartz.

Alerts

A blockquote whose first line is one of five special tags renders as a colored callout box. The five types: [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION].

You type
> [!NOTE]
> Useful information users should know.

> [!WARNING]
> Critical content demanding attention.
You get
ⓘ Note

Useful information users should know.

⚠ Warning

Critical content demanding attention.

Emoji shortcodes

Type a colon, the emoji name, and a closing colon. GitHub replaces the shortcode with the emoji.

You type
Shipped! :tada: :rocket:
You get

Shipped! 🎉 🚀

Mentions and references

On GitHub, @username mentions a user (and notifies them), and #123 auto-links to issue or pull request 123. These only work on github.com itself.

Common Markdown Mistakes

Five errors behind most “my Markdown isn’t rendering” moments:

  1. No space after #: #Heading is plain text, while # Heading is a heading.
  2. Missing blank line before a list, table, or heading: it merges into the paragraph above.
  3. Accidental code block: indenting a paragraph by 4+ spaces turns it into a code block.
  4. Wrong nesting indent: nested list items must line up under the parent item’s text, not just “be indented a bit”.
  5. Missing divider row in tables: without the | --- | --- | line, pipes render as literal text.

Tip: The fastest way to catch all five: paste your document into the Markdown validator. It checks 50+ rules and fixes most issues in one click, entirely in your browser.

Markdown Cheat Sheet FAQ

Quick answers to the questions people actually ask about Markdown syntax.

How long does it take to learn Markdown?

About 20 minutes for the basics. Markdown was designed to be readable as plain text, so most people learn headings, bold, italics, lists, and links in one sitting. Bookmark this cheat sheet for the syntax you will forget - even developers with years of experience look up table and link syntax regularly.

Does Markdown work the same everywhere?

The core syntax in this cheat sheet - headings, emphasis, lists, links, images, blockquotes, and code - works in virtually every Markdown app because it comes from the original spec and CommonMark. Extended features like tables, task lists, strikethrough, footnotes, and alerts come from GitHub Flavored Markdown (GFM) and are supported by most, but not all, tools. Elements marked GFM on this page belong to that second group.

How do I add a line break inside a Markdown table cell?

Use the HTML tag <br> where you want the break, for example: | First line<br>Second line |. Markdown tables have no native syntax for multi-line cells - a newline inside a cell would end the table row - so the <br> tag is the standard solution supported by GitHub and most renderers.

How do I resize an image in Markdown?

Standard Markdown has no syntax for image dimensions. The reliable, portable fix is to use an HTML img tag instead: <img src="image.png" alt="description" width="400">. This works on GitHub, GitLab, and most renderers that allow inline HTML.

What is the difference between CommonMark and GitHub Flavored Markdown?

CommonMark is the unambiguous specification of core Markdown syntax. GitHub Flavored Markdown (GFM) is a strict superset of CommonMark that adds tables, task lists, strikethrough, and autolinks. On github.com you also get alerts, footnotes, mentions, and emoji shortcodes. Anything that is valid CommonMark is also valid GFM.

How can I check that my Markdown is correct?

Paste it into our free Markdown preview to see exactly how it renders, or run it through the Markdown validator, which checks your source against 50+ markdownlint rules and can fix most issues in one click. Both tools run entirely in your browser - nothing is uploaded.

Now Write Some Markdown

Try any syntax from this cheat sheet in the live preview, validate your document against 50+ rules, or turn it into a polished PDF. Free, private, no signup.

Open the Live Preview