Markdown Cheat Sheet
Basic, extended, and GitHub Markdown syntax on one page. Every snippet has a copy button and a preview, and a label that says where it renders.
Short answer
Markdown formats plain text with symbols: # Heading, **bold**, *italic*, [text](url), - list item, > quote, and backticks for `code`. Those are CommonMark and work almost everywhere. Tables, task lists, and ~~strikethrough~~ are GitHub Flavored Markdown extensions, while footnotes, highlights, and definition lists are extended syntax that only some apps render.
- CommonMarkCore Markdown. Works in almost every renderer.
- GFMGitHub Flavored Markdown extension. GitHub, GitLab, Obsidian, and most modern renderers.
- ExtendedOnly some apps. Plain text everywhere else.
- HTMLRaw HTML. Works where the renderer allows HTML, not in chat apps.
- GitHubGitHub.com features beyond the GFM spec.
Markdown Syntax at a Glance
Every element in one table. The sections below have a copy button and a rendered preview for each.
| Element | Markdown | Works in |
|---|---|---|
| Heading | # H1 ## H2 ### H3 | CommonMark |
| Bold | **bold** | CommonMark |
| Italic | *italic* | CommonMark |
| Strikethrough | ~~text~~ | GFM |
| Link | [text](https://example.com) | CommonMark |
| Image |  | CommonMark |
| Bulleted list | - item | CommonMark |
| Numbered list | 1. item | CommonMark |
| Task list | - [ ] task | GFM |
| Blockquote | > quote | CommonMark |
| Inline code | `code` | CommonMark |
| Code block | ```lang … ``` | CommonMark |
| Table | | a | b | then |---|---| | GFM |
| Horizontal rule | --- | CommonMark |
| Line break | end the line with \ | CommonMark |
| Footnote | text[^1] then [^1]: note | Extended |
| Highlight | ==text== | Extended |
| Underline | <ins>text</ins> | HTML |
| Comment | <!-- hidden --> | HTML |
| Collapsible section | <details><summary>… | HTML |
| Alert | > [!NOTE] | GitHub |
Headings
Headings guideStart a line with one to six # characters and a space. More # characters make a smaller heading. The space is required: #Heading stays plain text.
# Heading 1Heading 1
## Heading 2Heading 2
### Heading 3Heading 3
#### Heading 4Heading 4
##### Heading 5Heading 5
###### Heading 6Heading 6
Heading 2
---------Heading 2
Text Formatting
Bold guideWrap text in asterisks or underscores. Strikethrough is a GFM extension, and Markdown has no underline syntax at all.
**bold text**bold text
*italic text*italic text
__bold__ and _italic_bold and italic
***bold and italic***bold and italic
~~strikethrough~~strikethrough
<ins>underlined</ins>underlined
Links
Links guidePut the link text in square brackets and the URL in parentheses, with no space between them.
[Link text](https://example.com)[Link text](https://example.com "Title")<https://example.com>https://example.com<email@example.com>[Reference link][1]
[1]: https://example.com[Jump to Tables](#tables)Images
Images guideSame as a link with a ! in front. The text in brackets is the alt text screen readers announce.
<img src="image.jpg" alt="Alt text" width="300">Lists
Lists guideStart lines with -, *, or + for bullets, or a number and a period for steps. To nest, indent the item to line up with the parent's text: 2 spaces under -, 3 under 1.
- Apple
- Banana
- Cherry- Apple
- Banana
- Cherry
1. First step
2. Second step
3. Third step- First step
- Second step
- Third step
- Fruits
- Apple
- Banana
- Vegetables
- Carrot- Fruits
- Apple
- Banana
- Vegetables
- Carrot
1. First step
- A detail
2. Second step- First step
- A detail
- Second step
Task Lists
Checkboxes guideA GFM extension: [ ] for open, [x] for done. On GitHub the boxes are clickable in issue and pull request comments and read-only in a rendered .md file.
- [x] Write documentation
- [x] Push to GitHub
- [ ] Deploy to production
- [ ] Celebrate 🎉- Write documentation
- Push to GitHub
- Deploy to production
- Celebrate 🎉
Blockquotes
Quotes guideStart each line with >. Lines in one quote join into a single paragraph, so use an empty > line to start a new one.
> This is a quote.This is a quote.
> "The only way to do great work
> is to love what you do."
>
> — Steve Jobs"The only way to do great work is to love what you do."
— Steve Jobs
> Note: Important information
>> Warning: Be careful hereNote: Important information
Warning: Be careful here
Backticks for code inside a sentence, three backticks (or three tildes) on their own lines for a block. The word after the opening fence names the language for syntax highlighting.
`const x = 42;`const x = 42;
``Use `code` here``Use `code` here
```javascript
function greet(name) {
return `Hello, ${name}!`;
}
```function greet(name) {
return `Hello, ${name}!`;
}```python
def greet(name):
return f"Hello, {name}!"
```def greet(name):
return f"Hello, {name}!"```
No language specified
Plain code block
```No language specified
Plain code blockTables
Tables guideA GFM extension. The row of dashes under the header is required, colons in it set alignment, and a literal pipe inside a cell is written \|.
| Name | Role |
|---------|-----------|
| Alice | Developer |
| Bob | Designer || Name | Role |
|---|---|
| Alice | Developer |
| Bob | Designer |
| Left | Center | Right |
|:-------|:-------:|-------:|
| L | C | R |
| Text | Text | Text || Left | Center | Right |
|---|---|---|
| L | C | R |
| Text | Text | Text |
Horizontal Rules
Horizontal rules guideThree or more -, *, or _ on a line by themselves. Leave a blank line above ---, or the text above it becomes a heading.
---***___Line Breaks & Paragraphs
Line breaks guideIn CommonMark and GFM files a single Enter does not start a new line. End the line with a backslash or two spaces, or leave a blank line for a new paragraph.
Line one
Line twoLine one Line two
Line one\
Line twoLine one
Line two
Line one··
Line twoLine one
Line two
Paragraph one.
Paragraph two.Paragraph one.
Paragraph two.
Line one<br>Line twoLine one
Line two
Escaping Characters
Put a backslash in front of any ASCII punctuation character to show it literally instead of formatting with it.
\*not italic\**not italic*
\# Not a heading# Not a heading
\[Not a link\](url)[Not a link](url)
1986\. A great year.1986. A great year.
Extended Syntax
Footnotes guideNot part of CommonMark or the GFM spec. Each one renders only in the apps named; everywhere else the characters show up as plain text.
==highlighted text==highlighted text
### My Heading {#custom-id}My Heading
Term
: Definition of the term- Term
- Definition of the term
H~2~O and X^2^H2O and X2
:tada: :+1:🎉 👍
| Syntax | GitHub | Obsidian | Also in |
|---|---|---|---|
| Footnotes [^1] | Yes (not in wikis) | Yes | Pandoc, MultiMarkdown, PHP Markdown Extra |
| Highlight ==text== | No, use <mark> | Yes | Typora (when enabled) |
| Heading ID {#id} | No, IDs are automatic | No | Pandoc, kramdown, PHP Markdown Extra |
| Definition list | No | No | Pandoc, kramdown, PHP Markdown Extra |
| Sub/superscript ~ ^ | No, use <sub>/<sup> | No, use <sub>/<sup> | Pandoc, R Markdown |
| Emoji :shortcode: | Yes | No (plugins exist) | Slack, Discord message boxes |
| Alerts > [!NOTE] | Yes | Yes, as callouts | Varies by tool; check yours |
GitHub Extras
GitHub Markdown guideBeyond CommonMark and GFM, GitHub renders footnotes, emoji shortcodes, and the features below. In issues, pull requests, and comments a single Enter is a line break; in .md files it is not.
> [!NOTE]
> Useful information readers should know.Note
Useful information readers should know.
<details>
<summary>Click to expand</summary>
Hidden content with **Markdown**.
</details>Click to expand
Hidden content with Markdown.
The area is $\pi r^2$.The area is πr2.
H<sub>2</sub>O and x<sup>2</sup>H2O and x2
@octocat can you review #123?@octocat can you review #123?
Common Mistakes
The six slips behind most "my Markdown isn't working" questions, checked against the CommonMark and GFM specs.
No space after #
Wrong
#HeadingRight
# HeadingCommonMark needs a space after the # characters. Without it the line stays plain text.
Dashes right under a line of text
Wrong
Some text
---Right
Some text
---Dashes directly under text turn that text into a level 2 heading. A blank line above makes a rule.
Expecting Enter to start a new line
Wrong
Line one
Line twoRight
Line one\
Line twoIn .md files the two lines join into one. End the first line with a backslash.
Two spaces under a numbered item
Wrong
1. Step
- DetailRight
1. Step
- DetailA nested item has to line up with the parent's text, which starts 3 characters in after "1. ".
Tilde subscript on GitHub
Wrong
H~2~ORight
H<sub>2</sub>OGitHub treats a single pair of tildes as strikethrough, so the 2 gets crossed out.
A table without the dash row
Wrong
| a | b |
| 1 | 2 |Right
| a | b |
|---|---|
| 1 | 2 |Without the delimiter row under the header, GFM renders the pipes as plain text.
Frequently Asked Questions
What is the basic syntax of Markdown?
Headings (# Heading), bold (**text**), italic (*text*), links ([text](url)), images (), lists (- item or 1. item), blockquotes (> text), inline code (`code`), fenced code blocks (```), and horizontal rules (---). These come from the original 2004 syntax, and the CommonMark spec defines them precisely, so they render the same almost everywhere.
What is the difference between basic and extended Markdown syntax?
Basic syntax is what the original Markdown and the CommonMark spec define. Extended syntax was added later by specific flavors: GitHub Flavored Markdown adds tables, task lists, strikethrough, and bare-URL autolinks, and other tools add footnotes, highlights, definition lists, custom heading IDs, and emoji shortcodes. Extended syntax only renders in apps that support it.
Does GitHub support everything on this cheat sheet?
GitHub supports every CommonMark and GFM row, plus footnotes, emoji shortcodes, alerts, math, and the HTML tags shown here (<ins>, <sub>, <sup>, <details>, <mark>). It does not support ==highlight==, definition lists, custom {#heading-ids}, or H~2~O subscript. A single pair of tildes is strikethrough on GitHub.
How do I make a new line in Markdown?
End the line with a backslash (\) or two spaces, or leave a blank line to start a new paragraph. A single Enter is ignored in CommonMark and GFM files, so the two lines join. GitHub comments, Discord, and Slack are the exceptions: there, Enter does start a new line.
How do I underline text in Markdown?
Markdown has no underline syntax, and underscores make italics. Where HTML is allowed, use <ins>text</ins>, the tag GitHub documents for underlining. Discord is the exception: __text__ underlines there.
Why is my Markdown not formatting?
Usually one of four things: the app does not parse Markdown at all (or not that syntax), a required space is missing (#Heading, -item), a GFM or extended feature is used in a renderer that only supports CommonMark, or the text sits inside a code block. Check the label on each row above to see where a syntax works.
Can I download or print this Markdown cheat sheet?
Use your browser's print dialog (Ctrl+P or Cmd+P) and choose Save as PDF. To turn your own Markdown file into a PDF, use the free Markdown to PDF converter on this site.