Back to blog
·7 min read

The Ultimate Markdown Cheat Sheet

A complete reference for every Markdown syntax element — headings, lists, code blocks, tables, links, images, footnotes, task lists, and more.

Markdown is the most widely used lightweight markup language in the world. It powers GitHub READMEs, documentation sites, blog platforms, note-taking apps, and countless other tools. Whether you are writing a quick comment or building an entire documentation site, knowing the full syntax gives you a serious advantage.

This cheat sheet covers every standard Markdown element plus the most useful extensions. Bookmark it. You will come back to it.

Headings

Headings use hash symbols. One hash for the largest heading, six for the smallest. Always put a space between the hash and the text.

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

Best practice: Use headings hierarchically. Don't skip from ## to ####. Screen readers and search engines rely on heading order to understand your document structure. Start your document with a single # heading and nest subheadings logically beneath it.

Paragraphs and Line Breaks

Paragraphs are separated by a blank line. If you just hit Enter once, Markdown treats it as the same paragraph.

To force a line break without starting a new paragraph, end a line with two spaces or use a <br> tag. However, most modern Markdown renderers handle single newlines gracefully, so test your target platform before relying on trailing spaces.

Emphasis and Strong Text

*italic text* or _italic text_
**bold text** or __bold text__
***bold and italic*** or ___bold and italic___
~~strikethrough text~~

Tip: Stick with asterisks for consistency. Underscores can cause problems inside words (like some_variable_name), while asterisks always work: some*variable*name will only italicize "variable."

Lists

Unordered Lists

Use -, *, or + followed by a space. Pick one style and stick with it throughout your document.

- First item
- Second item
  - Nested item
  - Another nested item
- Third item

Ordered Lists

Use numbers followed by a period. The actual numbers don't matter — Markdown will renumber them automatically. But starting with 1. and incrementing is good practice for readability in the raw source.

1. First step
2. Second step
3. Third step
   1. Sub-step A
   2. Sub-step B

Task Lists

Task lists (also called checklists) are a GitHub Flavored Markdown extension supported by most platforms.

- [x] Write the introduction
- [x] Add code examples
- [ ] Review and edit
- [ ] Publish

This renders as interactive checkboxes on GitHub, Obsidian, and many other platforms. They are incredibly useful in pull request descriptions and project planning documents.

Links

[Link text](https://example.com)
[Link with title](https://example.com "Hover text")

Reference-Style Links

For documents with many links, reference-style links keep your text readable:

Check out [Markdown Guide][1] and [GitHub Docs][2] for more.

[1]: https://www.markdownguide.org
[2]: https://docs.github.com

Autolinks

Most Markdown processors automatically turn URLs into clickable links, but you can make it explicit with angle brackets:

<https://example.com>
<user@example.com>

Images

Images use the same syntax as links, but with an exclamation mark in front:

![Alt text](image-url.png)
![Screenshot of the dashboard](./images/dashboard.png "Dashboard overview")

Accessibility note: Always write meaningful alt text. "Screenshot" is not helpful. "Dashboard showing three charts: revenue, users, and latency" tells screen reader users what the image contains.

Linking an Image

Wrap the image syntax inside a link to make clickable images:

[![Alt text](thumbnail.png)](https://example.com/full-image.png)

Code

Inline Code

Wrap text in backticks for inline code:

Run `npm install` to install dependencies.

Code Blocks

Use triple backticks (fenced code blocks) with an optional language identifier for syntax highlighting:

```javascript
function greet(name) {
  return `Hello, ${name}!`;
}
```

Common language identifiers: javascript, typescript, python, bash, json, html, css, markdown, yaml, go, rust, sql, diff.

Diff Syntax

Use the diff language identifier to show additions and removals:

```diff
- const old = "before";
+ const updated = "after";
```

This is extremely useful in documentation when showing what changed in a configuration file or code snippet.

Blockquotes

Use > for blockquotes. You can nest them and combine them with other elements:

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

> **Note:** You can use **bold**, *italic*, and `code` inside blockquotes.

> > Nested blockquotes work by doubling the `>` symbol.

Many documentation sites use blockquotes as callouts for tips, warnings, and notes. GitHub even supports special syntax for this:

> [!NOTE]
> This is a note callout on GitHub.

> [!WARNING]
> This is a warning callout on GitHub.

Tables

Tables use pipes and hyphens. The alignment row (the second row) is required:

| Feature       | Free Plan | Pro Plan   |
|---------------|-----------|------------|
| Storage       | 5 GB      | 100 GB     |
| API calls     | 1,000/mo  | Unlimited  |
| Support       | Community | Priority   |

Table Alignment

Use colons in the separator row to control column alignment:

| Left-aligned | Center-aligned | Right-aligned |
|:-------------|:--------------:|--------------:|
| Text         | Text           | Text          |
| More text    | More text      | 100.00        |

Tip: Tables don't need to be perfectly aligned in the source. The pipes just need to be in the right places. But aligning them makes your raw Markdown much easier to read and edit.

Horizontal Rules

Three or more hyphens, asterisks, or underscores on their own line:

---
***
___

All three produce the same result. Hyphens are the most common convention. Use horizontal rules sparingly — headings are usually a better way to divide sections.

Footnotes

Footnotes are supported by GitHub Flavored Markdown and many other processors:

Here is a statement that needs a citation.[^1]

Another claim with a different source.[^note]

[^1]: First footnote with the source URL.
[^note]: You can use words as footnote identifiers too.

Footnotes are rendered at the bottom of the page with back-links. They are perfect for academic writing, blog posts with citations, and documentation that references external specifications.

HTML in Markdown

Most Markdown processors allow inline HTML. This is useful for things Markdown doesn't natively support:

<details>
<summary>Click to expand</summary>

This content is hidden by default. It supports **Markdown** inside the HTML tags.

</details>

The <details> and <summary> pattern is widely used in GitHub READMEs and documentation for collapsible sections. Other useful HTML elements in Markdown include <kbd> for keyboard shortcuts (like Ctrl + C), <sub> for subscript, and <sup> for superscript.

Escaping Special Characters

If you need to display a character that Markdown normally interprets as formatting, escape it with a backslash:

\* This is not italic \*
\# This is not a heading
\[This is not a link\](or-this)

Characters you can escape: \, `, *, _, {}, [], (), #, +, -, ., !, |.

Definition Lists

Some extended Markdown processors (including PHP Markdown Extra and Pandoc) support definition lists:

Markdown
: A lightweight markup language for creating formatted text using a plain-text editor.

HTML
: The standard markup language for documents designed to be displayed in a web browser.

Math Notation

GitHub, GitLab, and many documentation tools support LaTeX math notation:

Inline math: $E = mc^2$

Block math:
$$
\sum_{i=1}^{n} x_i = x_1 + x_2 + \cdots + x_n
$$

This is essential for technical and scientific documentation. If your platform supports it, math notation lets you write equations directly in your Markdown files instead of embedding images.

Putting It All Together

Markdown's power comes from its simplicity. You can write a complete blog post, a detailed API reference, or a full project README using nothing but a text editor and the syntax on this page. No special software, no proprietary format, no lock-in.

The key to getting good at Markdown is using it daily. Write your notes in Markdown. Write your commit messages with Markdown formatting. Draft your emails in Markdown and convert them. The syntax becomes muscle memory faster than you'd expect.

Keep this cheat sheet handy until it does.