Markdown Cheat Sheet

Complete Markdown syntax reference. From basic formatting to GitHub Flavored Markdown extras. Bookmark this page for quick reference.

Basic Syntax

MarkdownResult / Description
# Heading 1Largest heading (<h1>)
## Heading 2Second-level heading (<h2>)
### Heading 3Third-level heading (<h3>)
#### Heading 4Fourth-level heading (<h4>)
##### Heading 5Fifth-level heading (<h5>)
###### Heading 6Smallest heading (<h6>)
Heading 1
=========
Alternative h1 syntax (underline with =)
Heading 2
---------
Alternative h2 syntax (underline with -)
Regular paragraph text.Paragraphs are separated by a blank line
Line one  
Line two
Two trailing spaces create a line break (<br>)
Line one\
Line two
Backslash at end of line also creates a line break
*italic* or _italic_italic
**bold** or __bold__bold
***bold italic***bold italic
~~strikethrough~~strikethrough (GFM)
> This is a blockquoteBlockquote (indented block)
> Line 1
>
> Line 2
Multi-paragraph blockquote
> Outer
>> Nested
Nested blockquotes

Lists

MarkdownResult / Description
- Item 1
- Item 2
- Item 3
Unordered list (also * or +)
1. First
2. Second
3. Third
Ordered list
1. First
1. Second
1. Third
Ordered list (auto-numbered, all 1.)
- Item
  - Nested
    - Deep nested
Nested list (indent 2-4 spaces)
1. Ordered
   - Unordered child
Mixed nested lists
- [x] Done task
- [ ] Open task
Task list / checkbox (GFM)
- Item 1

  Paragraph inside

- Item 2
List items with paragraphs (indent continuation)
- Item 1

  ```
  code block
  ```

- Item 2
Code block inside a list item (indent 2+ spaces)

Links

MarkdownResult / Description
[Link Text](https://example.com)Inline link
[Link](https://example.com "Title")Inline link with hover title
[Link][ref]

[ref]: https://example.com
Reference-style link
[Link][1]

[1]: https://example.com "Title"
Numbered reference link with title
<https://example.com>Autolink (URL displayed as clickable link)
https://example.comBare URL autolink (GFM only)
<user@example.com>Email autolink
[Section](#heading-id)Link to a heading anchor on the same page
[Top](#)Link back to top of page

Images

MarkdownResult / Description
![Alt text](image.png)Inline image
![Alt text](image.png "Title")Image with hover title
![Alt][ref]

[ref]: image.png
Reference-style image
[![Alt](img.png)](link)Linked image (image wrapped in a link)
![](image.png)Image without alt text (not recommended for a11y)
<img src="img.png" width="300">HTML image with custom size (Markdown has no size syntax)

Code

MarkdownResult / Description
`inline code`Inline code with backticks
``code with `backtick` inside``Inline code containing backticks (use double backticks)
```
code block
```
Fenced code block (triple backticks)
~~~
code block
~~~
Fenced code block (triple tildes)
```javascript
const x = 1;
```
Fenced block with syntax highlighting (specify language)
```python
print("hello")
```
Python syntax highlighting
```diff
- removed
+ added
```
Diff syntax highlighting
    indented codeIndented code block (4 spaces or 1 tab)

Tables

MarkdownResult / Description
| Col 1 | Col 2 |
|-------|-------|
| Cell  | Cell  |
Basic table with header row
| Left | Center | Right |
|:-----|:------:|------:|
| L    | C      | R     |
Column alignment: left, center, right
| Name | Value |
|------|-------|
| `code` | **bold** |
Inline formatting works inside table cells
| A | B |
|---|---|
| 1 | 2 |
| 3 | 4 |
Minimal table (pipes and hyphens required)
Col 1 | Col 2
------|------
A | B
Outer pipes are optional (GFM)
| Col \| Escaped |
|----------------|
| Use \| in cells |
Escape pipe character with backslash inside cells

Horizontal Rules

MarkdownResult / Description
---Horizontal rule (three hyphens)
***Horizontal rule (three asterisks)
___Horizontal rule (three underscores)
- - -Horizontal rule (spaced hyphens also work)

HTML in Markdown

MarkdownResult / Description
<br>Line break
<sup>text</sup>Superscript: text
<sub>text</sub>Subscript: text
<kbd>Ctrl+C</kbd>Keyboard key: Ctrl+C
<mark>highlighted</mark>Highlighted text: highlighted
<details>
<summary>Click me</summary>
Hidden content
</details>
Collapsible section (HTML5)
<dl><dt>Term</dt>
<dd>Definition</dd></dl>
Definition list (no Markdown equivalent)
<div align="center">
Centered text
</div>
Center-aligned content

Escaping Characters

MarkdownResult / Description
\*not italic\*Escaped asterisks appear literally: *not italic*
\# not a headingEscaped hash: # not a heading
\- not a listEscaped hyphen: - not a list
\[not a link\]Escaped brackets: [not a link]
\`not code\`Escaped backticks: `not code`
\\Literal backslash: \
\| \{ \} \( \) \. \!Other escapable characters: | { } ( ) . !

GitHub Flavored Markdown (GFM)

MarkdownResult / Description
- [x] Complete
- [ ] Incomplete
Task lists with checkboxes
~~strikethrough~~strikethrough text
#123Auto-linked issue/PR reference (GitHub repos)
@usernameUser mention (GitHub notification)
:emoji_name:Emoji shortcode (e.g., :rocket: for a rocket)
Text[^1]

[^1]: Footnote text.
Footnotes (rendered at bottom of page)
Text[^note]

[^note]: Named footnote.
Named footnotes
> [!NOTE]
> Info message
Alert: informational note (blue)
> [!TIP]
> Helpful advice
Alert: tip (green)
> [!IMPORTANT]
> Key information
Alert: important (purple)
> [!WARNING]
> Potential issue
Alert: warning (yellow)
> [!CAUTION]
> Danger zone
Alert: caution (red)
```mermaid
graph TD;
  A-->B;
```
Mermaid diagram (flowchart, sequence, etc.)
```mermaid
sequenceDiagram
  A->>B: Hello
```
Mermaid sequence diagram
```geojson
{ "type": "Point" }
```
GeoJSON map rendering (GitHub)
```math
E = mc^2
```
Math expressions with LaTeX syntax (GitHub)
$E = mc^2$Inline math expression (GitHub)