← Blog

The complete Markdown syntax cheat sheet

Every Markdown syntax — headings, bold, italic, lists, links, images, code, tables, footnotes — in one copy-paste reference. CommonMark and GitHub Flavored.

The full Markdown syntax reference, in one page. Covers CommonMark (the formal standard) andGitHub Flavored Markdown extensions (tables, task lists, strikethrough). Bookmark-able; copy-pasteable.

If you're new to Markdown, start withWhat is Markdown? A complete guide. If you want to see this rendered in a real editor, paste the snippets intoMarkdown Tidy.

Headings

# H1

## H2

### H3

#### H4

##### H5

###### H6

ATX-style (hash characters) is the modern convention. The older "Setext" style (underlining with=== for H1 or--- for H2) still works but reads worse in source.

Bold, italic, strikethrough

**bold** or **bold**
_italic_ or _italic_
**_bold italic_** or **_bold italic_**
~~strikethrough~~ (GFM)

In Slack, this works differently —*bold* is single-asterisk. SeeMarkdown in Slack.

Paragraphs and line breaks

Paragraphs are separated by blank lines.

A single newline
joins lines into one paragraph.

A line ending in two spaces  
forces a line break inside a paragraph.

Lists

- Unordered
- Item
  - Nested (two-space indent)

1. Ordered
2. Item
   1. Nested ordered

- [ ] Unchecked task (GFM)
- [x] Done task (GFM)

SeeMarkdown lists for the full list rules — nesting, paragraphs inside items, mixing ordered + unordered.

[Inline link](https://example.com)
[Link with title](https://example.com 'Hover title')

[Reference link][ref]

[ref]: https://example.com 'Optional title'

<https://example.com> (autolink — GFM auto-converts bare URLs too)

Images

![Alt text](path/to/image.png)
![Alt text](path/to/image.png 'Hover title')

![Alt][image-ref]

[image-ref]: path/to/image.png

Code

`inline code` — wrap with single backticks.

Use ``backticks containing ` characters`` with two-backtick fences.

Fenced code blocks:

```
no language
```

```python
def hello():
    print("with language hint — syntax highlighted")
```

```js
const greet = () => console.log('any language tag works');
```

SeeMarkdown code blocks for the full rules — escape characters, indented vs fenced, mixed languages, etc.

Blockquotes

> A single quoted line.
>
> Multiple paragraphs by repeating `>` on blank-ish lines.
>
> > Nested quote.

Tables (GFM)

| Header 1 | Header 2 | Right-aligned |
| -------- | :------: | ------------: |
| Cell     | Centered |    Right cell |
| Row 2    |   Cell   |        99,999 |

The colon in the delimiter row (:--,:-:,--:) controls alignment. Tables don't exist in pure CommonMark — they're a GFM extension. Most renderers support them.

If your AI-generated tables are broken, seeHow to repair broken Markdown tables in 30 seconds.

Horizontal rules

---

(three or more hyphens, asterisks, or underscores on their own line)

Escaping

To render a Markdown character literally, escape it with\:

\*literal asterisk\*
\[literal brackets\]
\`literal backtick\`
\# literal hash

HTML inside Markdown

Most renderers accept inline HTML:

This paragraph contains <em>HTML emphasis</em> and a <span style="color: red">red span</span>.

<div class="callout">
A block-level HTML div with **Markdown still parsed inside**.
</div>

The caveat: HTML inside Markdown is a security risk if your input isn't trusted. Most renderers (andMarkdown Tidy's HTML renderer) disable raw HTML by default for persisted output.

Footnotes (GFM / extended)

Here's a footnote reference[^1] and another[^longnote].

[^1]: This is the first footnote.

[^longnote]:
    Long footnotes can span paragraphs. Indent
    continuation lines with four spaces.

Supported in GFM and most extended dialects. Not in strict CommonMark.

Definition lists (extended)

Term
: Definition for the term.

Another term
: Definition.

Not in CommonMark or GFM. Supported by Pandoc, kramdown, and a few others.

@username — links to a user (on GitHub)
#1234 — links to issue/PR number (on GitHub)
:smile: — emoji shortcode (on many GFM renderers)
https://example.com — auto-detected and linked

These are GFM-specific. Behavior varies by host (GitHub, Gitea, GitLab).

Math (extended)

Inline math: $E = mc^2$

Block math:

$$
\int_a^b f(x)\,dx = F(b) - F(a)
$$

Supported by KaTeX/MathJax-equipped renderers, Jupyter notebooks, and many static-site generators. Not in core CommonMark.

Frontmatter (YAML)

---
title: My post
publishedAt: 2026-05-21
tags: [howto, markdown]
---

The content starts here.

Used by static-site generators (Jekyll, Hugo, Astro, Next.js) and tools likeMarkdown Tidy's blog system to extract metadata.

Platform variations

The same Markdown source renders differently in different places:

What this cheat sheet doesn't cover

  • MDX — Markdown + JSX components. A different beast; covered by the Astro/Next.js docs.
  • Pandoc Markdown — adds a lot beyond GFM (figures, citations, tables-with-rowspan).
  • AsciiDoc, reStructuredText, Org-mode — different markup languages that aren't Markdown.

For converting Markdown into a polished document — PDF, Word, HTML — seeMarkdown to PDF,Markdown to Word, andMarkdown to HTML. Or paste it intoMarkdown Tidy's editor and Export.

Try Markdown Tidy free

Paste markdown, get a polished document — no signup required.