Markdown Cheat Sheet: Syntax, Examples & GFM Reference
Copy Markdown syntax for headings, lists, links, images, code, tables, and task lists, with clear CommonMark and GitHub Flavored Markdown labels.
On this page
Use # for headings, **text** for bold, - for bullets, [text](url) for links, and backticks for code. The sections below separate portable CommonMark syntax from GFM extensions such as tables and task lists.
Copy an example, then test it in your target renderer because raw HTML, math, footnotes, and other extensions vary. For GFM details, see GitHub Flavored Markdown syntax.
Headings
# H1 — Page title ## H2 — Major section ### H3 — Sub-section #### H4 — Deeper ##### H5 ###### H6
Use one descriptive page title when your publishing system expects it, then nest headings without skipping levels. A logical hierarchy improves navigation for assistive technology and human readers.
An alternative "Setext" style exists for H1 and H2 but it's rarely used:
Page Title ========== Section -------
Emphasis
*italic* or _italic_ **bold** or __bold__ ***bold italic*** ~~strikethrough~~ (GFM) ==highlight== (extension — not universal)
Renders as: italic, bold, bold italic, strikethrough.
Lists
Unordered
- First item - Second item - Nested (2 spaces) - Another nested - Third item
You can use -, *, or +. Pick one consistently, and indent nested items enough for their parent marker and renderer.
Ordered
1. First 2. Second 3. Third
Many renderers continue numbering after the first marker, so repeated 1. markers are convenient:
1. First 1. Second 1. Third
The starting number can matter: a list beginning with 3. may render with a start value of 3. Preview when numbering carries meaning.
Task lists (GFM)
- [x] Completed task - [ ] Pending task - [ ] Another todo
Widely supported on GitHub, GitLab, Obsidian, Notion, and most modern editors.
Links
[Link text](https://example.com) [Link with title](https://example.com "Hover title") <https://example.com> — autolink <[email protected]> — autolink email
Reference-style links (great for long documents)
See [mdkit blog][1] and [the cheat sheet][cheatsheet] for more. [1]: https://mdkit.io/blog [cheatsheet]: https://mdkit.io/blog/markdown-cheat-sheet
Images
 
Reference-style also works:
![Alt][logo] [logo]: /images/logo.png
Write meaningful alt text for informative images and empty alt text for decorative images.
Image with link
[](https://example.com)
Code
Inline code
Use `code` for inline snippets, file names like `README.md`, or short identifiers.
Fenced code blocks with language
```javascript const greet = (name) => `Hello, ${name}!`; ``` ```python def greet(name): return f"Hello, {name}!" ``` ```bash npm install example-package ```
The language tag enables syntax highlighting in GitHub, static site generators, and most Markdown viewers.
Indented code blocks (legacy)
Prefix with four spaces:
No language highlighting here. Just plain monospace.
Fenced blocks are strongly preferred.
Blockquotes
> A single-line quote. > A multi-line > blockquote just works. > **With formatting** inside quotes. > > Even multiple paragraphs.
Nested quotes
> Outer quote > > > Inner quote > > Back to outer
Tables (GFM)
| Name | Role | Price | | :------ | :--------: | ----: | | Alice | Admin | $200 | | Bob | Editor | $50 | | Charlie | Viewer | $10 |
Alignment is set by the colons in the separator row:
:---→ left:---:→ center---:→ right
Tips: you don't need to align the pipes manually; most editors do it for you. Need a no-typing-required table? Try the Markdown Table Generator.
Horizontal rule
---
Three or more hyphens, asterisks, or underscores on their own line. Use sparingly — usually an H2 is a better section break.
Escaping special characters
Prefix with a backslash:
\*not italic\* \# not a heading \`not code\`
Escapable characters: \ ` * _ {} [] () # + - . ! |.
Line breaks
- Paragraph break: one blank line between paragraphs.
- Soft line break: a normal newline inside a paragraph; renderers commonly display it as a space.
- Hard line break: end a line with two spaces or a backslash, then newline.
- HTML break:
<br>works only when the renderer allows raw HTML.
HTML inside Markdown
CommonMark defines raw HTML blocks and inline HTML, but applications may disable, escape, or sanitize them:
<kbd>Ctrl</kbd> + <kbd>C</kbd> to copy. <details> <summary>Click to expand</summary> Hidden content goes here. </details> <sub>subscript</sub> and <sup>superscript</sup>
Some platforms (like GitHub comments) sanitize dangerous tags. Always test.
GFM extensions
GitHub Flavored Markdown adds these on top of CommonMark:
Autolinks
URLs become clickable automatically:
Visit https://mdkit.io — no brackets needed.
Task lists
(Covered above.)
Strikethrough
~~This is struck out.~~
Tables
(Covered above.)
Footnotes (Pandoc / some processors)
Here's a claim that needs a source.[^1] [^1]: Source details here.
Not universal — check your renderer.
Math (KaTeX / MathJax — extension)
Inline: $E = mc^2$ Block: $$ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $$
Supported by GitHub, Obsidian, many static site generators. Not part of CommonMark.
Diagrams (Mermaid — extension)
```mermaid graph TD A[Start] --> B[Write Markdown] B --> C{Valid?} C -->|Yes| D[Ship it] C -->|No| B ```
Supported by GitHub, GitLab, Notion, Obsidian.
Comments
Markdown has no native comment syntax. Use HTML:
<!-- This won't render. Useful for editor notes. -->
Front matter (YAML)
Used by static site generators (Hugo, Jekyll, Next.js MDX, Astro):
--- title: "My Post" date: "2026-02-04" tags: ["markdown", "guide"] --- Post content starts here.
The --- fences delimit the metadata block. Most renderers strip it before display.
Quick reference card
| What | How |
|---|---|
| Heading | # H1 to ###### H6 |
| Bold | **text** |
| Italic | *text* |
| Strikethrough | ~~text~~ |
| Link | [text](url) |
| Image |  |
| Code (inline) | `code` |
| Code block | ```lang … ``` |
| Blockquote | > text |
| Unordered list | - item |
| Ordered list | 1. item |
| Task list | - [ ] / - [x] |
| Table | | col | col | + separator row |
| Horizontal rule | --- |
| Line break | two trailing spaces |
Where to go next
Knowing the syntax is step one. Step two is actually writing good documentation. A few directions:
- Try it live in our browser-based Markdown editor with GFM, syntax highlighting, and preview.
- Convert existing HTML with the HTML to Markdown tool when migrating content.
- Export to PDF with Markdown to PDF for shareable reports.
- Learn GFM in depth in GitHub Flavored Markdown Explained.
- Write a proper README with our README template and dedicated guide.
Keep the syntax simple, preview in the destination renderer, and add extensions only when the audience can render them.
Frequently Asked Questions
Is Markdown a programming language?+
What's the difference between CommonMark and GitHub Flavored Markdown?+
Do all Markdown editors support the same syntax?+
How do I write a line break in Markdown?+
Can I use HTML inside Markdown?+
Keep reading
GitHub Flavored Markdown (GFM): Syntax & Examples
Learn formal GFM syntax for tables, task lists, strikethrough, autolinks, and tag filtering, plus which features belong only to GitHub.
Markdown vs HTML: Differences, Use Cases & Examples
Compare Markdown and HTML syntax, portability, rendering, security, accessibility, and use cases, with examples and a practical format decision table.
Markdown Table Syntax: Alignment, Examples & Generator
Build Markdown tables with correct GFM delimiters, column alignment, escaped pipes, accessible headers, examples, and a free table generator.