Markdown Cheat Sheet
Complete Markdown reference for GitHub, Notion, and more. Headers, links, images, tables, code blocks, and extended syntax.
Headings
| Syntax | Description | Example |
|---|---|---|
| Largest heading (H1) | # My Title | |
| Second-level heading (H2) | ## Section Title | |
| Third-level heading (H3) | ### Subsection | |
| Fourth-level heading (H4) | #### Minor heading | |
| Fifth-level heading (H5) | ##### Small heading | |
| Smallest heading (H6) | ###### Tiny heading | |
| Alt syntax for H1 | Title\
===== | |
| Alt syntax for H2 | Subtitle\
----- |
Text
| Syntax | Description | Example |
|---|---|---|
| Bold text | This is **important** | |
| Italic text | This is *emphasized* | |
| Bold and italic | ***Critical note*** | |
| Strikethrough text | ~~deleted text~~ | |
| Inline code | Use `npm install` | |
| Blockquote | > This is a quote | |
| Nested blockquote | >> Deeper quote | |
| Superscript | X<sup>2</sup> | |
| Subscript | H<sub>2</sub>O | |
| Highlighted text (some parsers) | ==important== |
Lists
| Syntax | Description | Example |
|---|---|---|
| Unordered list item | - Apples\
- Oranges | |
| Unordered list (alt syntax) | * First\
* Second | |
| Ordered list item | 1. Step one\
2. Step two | |
| Nested list (indent 3 spaces) | - Parent\
- Child | |
| Unchecked task | - [ ] Todo item | |
| Checked task | - [x] Done item |
Links
| Syntax | Description | Example |
|---|---|---|
| Inline link | [Google](https://google.com) | |
| Link with hover title | [Click](url "Hover text") | |
| Reference-style link | [Google][1]\
[1]: https://google.com | |
| Auto-linked URL | <https://example.com> | |
| Image |  | |
| Image with title |  | |
| Linked image | [](https://...) |
Code
| Syntax | Description | Example |
|---|---|---|
| Inline code | Run `npm start` | |
| Fenced code block | ```js\
console.log('hi')\
``` | |
| Indented code block (4 spaces) | const x = 1; | |
| Diff syntax highlighting | ```diff\
+ new line\
- old line\
``` | |
| JSON code block | ```json\
{ "key": "value" }\
``` | |
| Shell/terminal block | ```bash\
$ npm install\
``` |
Tables
| Syntax | Description | Example |
|---|---|---|
| Table header row | | Name | Age | | |
| Table separator (required) | | --- | --- | | |
| Left-align column | | :--- | Data | | |
| Center-align column | | :---: | Data | | |
| Right-align column | | ---: | Data | |
Structure
| Syntax | Description | Example |
|---|---|---|
| Horizontal rule | --- | |
| Horizontal rule (alt) | *** | |
| Horizontal rule (alt) | ___ | |
| Line break | Line one \
Line two | |
| HTML line break | Line one<br>Line two | |
| Backslash line break | Line one\\\
Line two |
Advanced
| Syntax | Description | Example |
|---|---|---|
| Footnote reference | Text[^1]\
[^1]: Footnote text | |
| Definition list | Git\
: Version control system | |
| Emoji shortcode | :rocket: :thumbsup: | |
| Collapsible section (HTML) | <details><summary>Click</summary>Hidden</details> | |
| Inline math (LaTeX) | $E = mc^2$ | |
| Math block (LaTeX) | $$\\sum_{i=1}^{n} x_i$$ | |
| HTML comment (hidden) | <!-- TODO: fix this --> | |
| Custom heading ID | ### Section {#my-section} | |
| Escape special characters | \\*not italic\\* |
Frequently asked questions
What's the difference between Markdown and HTML?
Markdown is a lightweight syntax that converts to HTML. It's designed to be readable as plain text. You write **bold** instead of <strong>bold</strong>. Most Markdown parsers also accept inline HTML for features Markdown doesn't cover.
Which Markdown flavor should I use?
CommonMark is the standard specification. GitHub Flavored Markdown (GFM) extends it with tables, task lists, and strikethrough. Most platforms (GitHub, GitLab, Notion, VS Code) use GFM or something very close to it.
How do I add images in Markdown?
Use . For sizing, you'll need HTML: <img src='url' width='300'>. GitHub also supports drag-and-drop image uploads in issues and PRs.
Can I create a table of contents?
Many platforms auto-generate a TOC from headings. Manually, link to headings: [Section](#section-name). The anchor is the heading text, lowercased, with spaces replaced by hyphens.
How do I escape special Markdown characters?
Use a backslash: \* for a literal asterisk, \# for a hash, \[ for a bracket. This prevents Markdown from interpreting them as formatting.
Does Markdown support colored text?
Standard Markdown doesn't support text colors. On GitHub, you can use diff code blocks (```diff) for red/green. For full color support, use inline HTML: <span style='color:red'>text</span> (works on some platforms).
Go from reference to real skills
Cheat sheets are great for quick lookups. Our in-depth courses take you from the fundamentals to professional-level mastery.
Browse all courses