Markdown Cheat Sheet: Syntax Guide With Examples
A complete reference for Markdown syntax — headings, formatting, tables, code, lists, and everything in between. Bookmark it, print it, or keep a copy in your project.
Headings
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
Use a space after #. One # per level — no mixing === underlines unless you're writing old-school Markdown.
Text Formatting
| Style | Syntax | Renders as |
|---|---|---|
| Bold | **bold text** or __bold text__ | bold text |
| Italic | *italic text* or _italic text_ | italic text |
| Bold + Italic | ***bold and italic*** | bold and italic |
| Strikethrough | ~~strikethrough~~ | |
| Inline code | `code` | code |
| Highlight | <mark>highlight</mark> | <mark>highlight</mark> |
| Subscript | <sub>sub</sub> | H<sub>2</sub>O |
| Superscript | <sup>sup</sup> | X<sup>2</sup> |
Strikethrough (
~~text~~) is a GitHub-flavoured Markdown extension, not part of original Markdown. It's supported by GitHub, GitLab, Discord, Slack, and most modern renderers.
Lists
Unordered
- Item one
- Item two
- Nested item (indent 2 spaces)
- Another nested item
- Item three
Ordered
1. First item
2. Second item
1. Nested numbered item (indent 3 spaces)
3. Third item
Numbers don't have to be sequential — Markdown renders them in order regardless:
1. First
1. Second
1. Third
All three render as 1, 2, 3.
Task Lists
- [x] Completed task
- [ ] Incomplete task
- [ ] Another task
- Completed task
- Incomplete task
Task lists are a GitHub-flavoured extension. Works on GitHub, GitLab, and most Markdown note apps.
Links
[Link text](https://example.com)
[Link with title](https://example.com "Optional title")
[Reference-style link][ref]
[ref]: https://example.com "Optional title"
Automatic link: <https://example.com>
Reference-style links keep the document readable: define [ref]: url once at the bottom, use [ref] inline anywhere.
Images


![Reference image][img-ref]
[img-ref]: https://example.com/image.png
Images are identical to links but with a ! prefix. The alt text is important for accessibility and shows when the image fails to load.
Code
Inline Code
Wrap text with single backticks: `const x = 1` renders as const x = 1.
Use double backticks when the code itself contains a backtick: `` `escaped` ``
Code Blocks
Fenced code blocks (recommended):
```python
def hello():
print("Hello, world!")
```
Indented code blocks (original Markdown):
Indent every line by 4 spaces
to create a code block
Specify the language after the opening triple backticks for syntax highlighting: ```javascript, ```bash, ```json, etc.
Tables
| Header 1 | Header 2 | Header 3 |
|----------|:--------:|---------:|
| Left | Center | Right |
| Default | aligned | aligned |
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Left | Center | Right |
| Default | aligned | aligned |
Alignment is controlled by colons in the separator row:
:---— left-aligned (default):---:— center-aligned---:— right-aligned
Tables are a GitHub-flavoured extension. Not all Markdown renderers support them.
Blockquotes
> This is a blockquote.
> It can span multiple lines.
> Nested blockquotes work too:
>> Second level
>>> Third level
This is a blockquote. It can span multiple lines.
Nested blockquotes work too:
Horizontal Rules
---
***
___
All three produce a horizontal line. Use three or more characters — --- is the most common.
Frontmatter (YAML)
---
title: My Document
date: 2026-11-03
tags: [markdown, reference]
---
Frontmatter is a block of YAML between --- delimiters at the top of the file. It's parsed by static site generators (Jekyll, Hugo), note apps (Obsidian), and documentation tools — but ignored by standard Markdown renderers.
Escaping Special Characters
Prefix any Markdown character with \ to render it literally:
\*Not italic\*
\# Not a heading
\[Not a link\]
| Escape | Renders as |
|---|---|
\* | * |
\# | # |
\[ | [ |
\ | ` (backtick) |
Line Breaks and Paragraphs
- Paragraph: separate blocks of text with a blank line.
- Line break: end a line with two spaces then Enter, or use
<br>. - Soft wrap: just hit Enter — in most renderers the text wraps but stays in the same paragraph.
HTML in Markdown
Raw HTML works inline in most renderers:
<div style="color: red">Red text</div>
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>
Useful for features Markdown doesn't cover: <details>, <kbd>, <sup>, alignment, and custom styling.
Quick Reference Card
| Element | Syntax |
|---|---|
| Heading | # H1 → ###### H6 |
| Bold | **text** |
| Italic | *text* |
| Strikethrough | ~~text~~ |
| Link | [text](url) |
| Image |  |
| Code (inline) | `code` |
| Code (block) | ``` ... ``` |
| List (bullet) | - item |
| List (numbered) | 1. item |
| Task list | - [ ] task |
| Table | | col | col | |
| Blockquote | > quote |
| Horizontal rule | --- |
| Frontmatter | --- YAML --- |