REFERENCE
MARKDOWN
CHEATSHEET
Complete syntax reference for Markdown and GitHub Flavored Markdown (GFM). Every element with examples you can copy directly.
HEADINGS
| Element | Syntax | Notes |
|---|---|---|
| Heading 1 | # Heading 1 | Largest heading, maps to <h1> |
| Heading 2 | ## Heading 2 | Maps to <h2> |
| Heading 3 | ### Heading 3 | Maps to <h3> |
| Heading 4 | #### Heading 4 | Maps to <h4> |
| Heading 5 | ##### Heading 5 | Maps to <h5> |
| Heading 6 | ###### Heading 6 | Smallest heading, maps to <h6> |
| Setext H1 | Heading ====== | Underline-style, H1 |
| Setext H2 | Heading ------ | Underline-style, H2 |
EMPHASIS
| Element | Syntax | Notes |
|---|---|---|
| Bold | **bold text** | Also __bold text__ |
| Italic | *italic text* | Also _italic text_ |
| Bold + Italic | ***bold italic*** | Also ___bold italic___ |
| Strikethrough | ~~strikethrough~~ | GFM only |
| Highlight | ==highlighted== | Some parsers only (not standard GFM) |
LINKS
| Element | Syntax | Notes |
|---|---|---|
| Inline link | [link text](https://example.com) | Basic inline link |
| Link with title | [link text](https://example.com "Title") | Title shown on hover |
| Reference link | [link text][ref-id] | Definition placed elsewhere in document |
| Reference definition | [ref-id]: https://example.com | Can be placed anywhere in the document |
| Auto-link | <https://example.com> | URL becomes a clickable link |
| Auto-link (email) | <user@example.com> | Email becomes mailto link |
| Bare URL (GFM) | https://example.com | GFM auto-links bare URLs without angle brackets |
IMAGES
| Element | Syntax | Notes |
|---|---|---|
| Inline image |  | Basic inline image; alt text required for accessibility |
| Image with title |  | Title shown on hover (tooltip) |
| Reference image | ![alt text][img-ref] | Defined as [img-ref]: image.png |
| Linked image | [](https://example.com) | Image that functions as a link |
LISTS
| Element | Syntax | Notes |
|---|---|---|
| Unordered (dash) | - Item | Can also use * or + |
| Unordered (asterisk) | * Item | Interchangeable with - |
| Ordered | 1. Item | Numbers auto-increment in most renderers |
| Ordered (any number) | 1. First 1. Second 1. Third | All 1. still renders as 1, 2, 3 |
| Nested list | - Item - Nested | Indent with 2 or 4 spaces |
| Nested ordered | 1. Item 1. Nested | 3 spaces for ordered nesting |
| Task list (GFM) | - [ ] Unchecked | Checkbox list item (space between brackets) |
| Task list checked (GFM) | - [x] Checked | Lowercase x marks as complete |
BLOCKQUOTES
| Element | Syntax | Notes |
|---|---|---|
| Single | > Quoted text | Renders as a blockquote element |
| Nested quote | >> Nested quote | Quote inside a quote |
| Multi-line | > Line 1 > Line 2 | Each line prefixed with > |
| Multi-paragraph | > Para 1 > > Para 2 | Blank > line separates paragraphs |
| With elements | > ## Heading > > Paragraph | Blockquotes can contain any block element |
CODE
| Element | Syntax | Notes |
|---|---|---|
| Inline code | `code` | Single backticks |
| Inline with backtick | `` `code with `backtick` `` | Use double backticks to wrap code containing a backtick |
| Fenced block | ``` code here ``` | Triple backticks; blank line before and after recommended |
| Fenced with language | ```javascript const x = 1 ``` | Enables syntax highlighting |
| Indented block | code | 4 spaces indent (or 1 tab); must be preceded by blank line |
| Common languages | javascripttypescriptpythonbashcsshtmljsonyaml | Language identifiers for fenced blocks |
TABLES GFM only
| Element | Syntax | Notes |
|---|---|---|
| Basic table | | Header | Header | |--------|--------| | Cell | Cell | | Pipes on both sides |
| Left-align | |:-------| | Colon on left side of dashes (default) |
| Center-align | |:------:| | Colons on both sides |
| Right-align | |-------:| | Colon on right side of dashes |
| Outer pipes optional | Header | Header -------|------- Cell | Cell | Leading and trailing pipes are optional |
TASK LISTS GFM only
| Element | Syntax | Notes |
|---|---|---|
| Unchecked | - [ ] Task to do | Space between the brackets |
| Checked | - [x] Completed task | Lowercase x marks item as complete |
| Checked (uppercase) | - [X] Also works | Uppercase X is also valid in most renderers |
| Nested tasks | - [ ] Parent task - [x] Sub-task done - [ ] Sub-task todo | Indent with 2 spaces |
HORIZONTAL RULES
| Element | Syntax | Notes |
|---|---|---|
| Dashes | --- | Three or more hyphens |
| Asterisks | *** | Three or more asterisks |
| Underscores | ___ | Three or more underscores |
| Spaced dashes | - - - | Spaces between characters are allowed |
| Important | Must be preceded by a blank line. Without one, a line of dashes after text is parsed as a Setext H2 heading. | |
HTML IN MARKDOWN
| Element | Syntax | Notes |
|---|---|---|
| Keyboard keys | <kbd>Ctrl</kbd>+<kbd>C</kbd> | Renders styled key names |
| Subscript | H<sub>2</sub>O | Subscript text |
| Superscript | E=mc<sup>2</sup> | Superscript text |
| Inline span | <span class="highlight">text</span> | Inline styled text |
| Block-level | <div> # Markdown here </div> | Blank lines required for markdown inside block HTML |
| Details/Summary | <details> <summary>Click to expand</summary> Hidden content here </details> | Collapsible section; widely supported |
ESCAPING CHARACTERS
| Element | Syntax | Notes |
|---|---|---|
| Escape asterisk | \*not italic\* | Backslash prevents markdown parsing |
| Escape underscore | \_not italic\_ | Renders as literal underscore |
| Escape backtick | \`not code\` | Renders as literal backtick |
| Escape hash | \# Not a heading | Renders as literal hash character |
| Escapable characters | \\\*\_\{\}\[\]\(\)\#\+\-\.\!\`\| | Full list of characters that can be escaped with backslash |
FRONTMATTER YAML
| Element | Syntax | Notes |
|---|---|---|
| Opening delimiter | --- | Triple dashes; must be the very first line of the file |
| String field | title: My Post | Unquoted strings work for most values |
| Quoted string | title: "Post: With Colon" | Quote when value contains special YAML characters |
| Date | date: 2024-01-15 | ISO 8601 date format |
| Boolean | draft: false | true or false, no quotes |
| Array (inline) | tags: [markdown, writing] | Flow sequence syntax |
| Array (block) | tags: - markdown - writing | Block sequence syntax; 2-space indent |
| Number | weight: 10 | Integers and floats without quotes |
| Closing delimiter | --- | Triple dashes close the frontmatter block |
| Full example | --- title: "Getting Started with Markdown" date: 2024-01-15 draft: false tags: - markdown - writing weight: 1 --- | |
TRY IT LIVE
Paste any of these examples into the online markdown editor to see them rendered instantly.