Home · Resources · Markdown Cheat Sheet

Markdown Cheat Sheet: Every Syntax with Examples (2026)

The most complete markdown cheat sheet on the internet — every CommonMark and GitHub Flavored Markdown feature, with a working example for each.
Updated for 2026 · By the Markdific team
Markdown Cheat Sheet 2026 cover

Markdown is the format powering README files, AI chatbot responses, technical documentation, blog posts, and most modern note-taking apps. Knowing the syntax saves hours every week. This is the most complete markdown cheat sheet on the internet, covering every CommonMark and GitHub Flavored Markdown feature with a working example for each.

Bookmark this page. Or grab the free PDF version at the end of the article to keep it within reach offline.


What is Markdown?

Markdown is a plain-text formatting syntax created by John Gruber and Aaron Swartz in 2004. It uses simple symbols to mark up text so it can be converted into HTML and other formats. The goal was readability. A markdown file should look clean as plain text and only get prettier when rendered.

Today markdown is everywhere. GitHub READMEs, Reddit posts, Discord messages, Notion pages, Obsidian notes, AI chatbot responses, and most documentation sites use it. If you write anything on a computer in 2026, you are almost certainly producing markdown whether you realise it or not.

For more on the format itself, read our complete guide to what a markdown file is. To see your rendered output cleanly, check out our roundup of the best markdown viewers in 2026.


Headings

Use # symbols at the start of a line to create headings. The number of hashes sets the heading level, from H1 (largest) to H6 (smallest).

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
Rendered output
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6

Alternative Heading Syntax (Setext)

For H1 and H2 only, you can use underline-style headings:

Heading 1
=========

Heading 2
---------

Most writers stick with the # syntax because it works at every level and is easier to scan.

Tips:


Paragraphs and Line Breaks

Paragraphs are separated by a blank line. Just hit Enter twice.

This is the first paragraph.

This is the second paragraph.

Line Breaks Within a Paragraph

To break a line without starting a new paragraph, end the line with two spaces followed by Enter, or use a backslash \:

First line.
Second line on a new line, same paragraph.

First line.\
Second line using backslash.

Both produce a <br> tag in HTML. The trailing-spaces method is more traditional but invisible in your editor, which causes confusion. The backslash method is clearer and supported by GitHub Flavored Markdown.


Bold, Italic, and Other Text Formatting

These are the formatting basics you will use constantly.

**bold text** or __bold text__
*italic text* or _italic text_
***bold and italic*** or ___bold and italic___
~~strikethrough text~~
Rendered
  • bold text
  • italic text
  • bold and italic
  • strikethrough

Bold and italic are part of core CommonMark and work everywhere. Strikethrough is a GFM extension covered in more detail below.

When to Use Asterisks vs Underscores

Both ** and __ produce bold. Both * and _ produce italic. They are interchangeable, but pick one and stick to it for consistency. Asterisks are more popular because they do not break inside words:

This works: this_word_has_underscores
This breaks: this*word*has*asterisks

If you need formatting inside a word, asterisks are safer:

un**believ**ably

Lists

Lists come in two flavours: unordered (bullets) and ordered (numbered).

Unordered Lists

Use -, *, or + followed by a space. All three work identically. Most style guides prefer -.

- First item
- Second item
- Third item
  - Nested item (indent 2 or 4 spaces)
  - Another nested item
    - Deep nested item
- Fourth item

Ordered Lists

Use numbers followed by a period. The actual numbers do not matter, markdown renumbers automatically:

1. First item
2. Second item
3. Third item
   1. Nested item
   2. Another nested item
4. Fourth item

You can also write this and get the same output:

1. First item
1. Second item
1. Third item

This is a feature, not a bug. It means you can reorder list items without renumbering by hand.

Mixed Lists

You can nest unordered lists inside ordered ones and vice versa:

1. Step one
2. Step two
   - Sub-point A
   - Sub-point B
3. Step three

Links use square brackets for the visible text and parentheses for the URL.

Basic Inline Links

[Markdific](https://markdific.com)
[Visit our blog](https://markdific.com/blog "Optional hover title")

Automatic Links

Wrap a URL in angle brackets to auto-link it:

<https://markdific.com>
<hello@example.com>

Reference-Style Links

Useful when the same link appears multiple times or when you want to keep the prose clean:

Read our [cheat sheet][1] or the [viewer roundup][2].

Later in the document or at the bottom:

[1]: https://markdific.com/resources/markdown-cheat-sheet
[2]: https://markdific.com/blog/best-markdown-viewers/

You can also use named references:

Check out [Markdific][md-home].

[md-home]: https://markdific.com

Linking to Sections (Anchor Links)

GitHub and most renderers auto-generate anchor IDs from heading text (lowercased, spaces replaced with hyphens):

[Jump to Tables](#tables)
[Jump to GitHub Alerts](#github-alerts)

Images

Image syntax is almost identical to links, with an exclamation mark in front.

![Alt text describing the image](path/to/image.jpg)
![Alt text](path/to/image.jpg "Optional hover title")

Image Sizing

Pure markdown does not support image sizing. You have two options:

Option 1: Use HTML directly

<img src="path/to/image.jpg" alt="Description" width="500">

Option 2: Use platform-specific extensions

Obsidian, for example, supports:

![[image.jpg|500]]

Reference-Style Images

![Markdific logo][logo]

[logo]: /images/logo.png "Markdific"

Linking an Image

To make an image clickable, wrap the image syntax in a link:

[![Alt text](image.jpg)](https://destination-url.com)

For a deeper dive into image handling including local files, URLs, and Base64 encoding, read our complete guide to adding images in markdown.


Code and Code Blocks

Code formatting is one of markdown's most useful features.

Inline Code

Wrap code in single backticks:

Use the `print()` function in Python.

If your code contains a backtick, wrap it in double backticks:

The character `` ` `` is called a backtick.

Code Blocks (Fenced)

Use triple backticks for multi-line code blocks. Add a language identifier after the opening backticks for syntax highlighting:

```python
def hello_world():
    print("Hello, world!")
```
```javascript
function helloWorld() {
  console.log("Hello, world!");
}
```
```bash
npm install markdown-it
```

Common Language Identifiers

Indented Code Blocks (Legacy)

Indent any line by four spaces or one tab to make it a code block. This works but is less readable than fenced blocks. Avoid it.


Blockquotes

Use > at the start of a line to create a blockquote.

> This is a blockquote.
> It can span multiple lines.

> You can also have a single-line blockquote.

Nested Blockquotes

Stack > characters:

> Outer quote.
>
> > Nested quote.
> >
> > > Deeply nested quote.

Blockquotes with Other Markdown

Blockquotes can contain headings, lists, code, and other formatting:

> ### A heading inside a quote
>
> - A list item
> - Another item
>
> Some `inline code` and **bold text**.

Horizontal Rules

Three or more hyphens, asterisks, or underscores on their own line:

---
***
___

All three render as <hr>. Use them sparingly. Most modern documents use heading hierarchy instead.


Tables

Tables are a GitHub Flavored Markdown extension, not standard CommonMark, but they are supported almost everywhere now.

Basic Table

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |
Rendered
Header 1Header 2Header 3
Cell 1Cell 2Cell 3
Cell 4Cell 5Cell 6

Column Alignment

Add colons to the separator line:

| Left-aligned | Center-aligned | Right-aligned |
|:-------------|:--------------:|--------------:|
| Text         | Text           | Text          |
| Longer text  | Longer text    | Longer text   |

Tips for Cleaner Tables

For a full guide including how to handle complex tables, plus our free markdown table generator, read our complete guide to markdown tables.


Task Lists

Task lists (also called to-do lists) are a GFM extension supported by GitHub, GitLab, and most modern editors.

- [x] Completed task
- [ ] Open task
- [ ] Another open task
  - [x] Nested completed sub-task
  - [ ] Nested open sub-task

The [x] is case-sensitive in some renderers. Use lowercase x to be safe.


Footnotes

Footnotes are a GFM extension. They are perfect for citations and asides.

This is a sentence with a footnote.[^1]

You can have multiple footnotes.[^note]

[^1]: This is the first footnote content.
[^note]: This is a named footnote with longer content
    that can span multiple lines if indented.

Footnotes auto-number themselves and appear at the bottom of the rendered document with backlinks.


Definition Lists

Definition lists are supported by Pandoc, MultiMarkdown, and some other flavours but not core GFM.

Term
: Definition of the term.

Markdown
: A lightweight markup language for creating formatted text.
: Created by John Gruber in 2004.

Check your target renderer before relying on these. They are inconsistent across platforms.


Strikethrough

Wrap text in double tildes:

~~This text is struck through~~

Rendered: This text is struck through

GFM extension. Universally supported in modern renderers.


Emoji

Three ways to use emoji in markdown:

1. Paste Directly

Just type or paste the actual emoji character: 🎉 ✅ 🚀

This works everywhere because emoji are just Unicode characters.

2. Shortcodes (GFM)

GitHub and GitLab support shortcode syntax that converts text codes into emoji:

:tada: :white_check_mark: :rocket:

These render as 🎉 ✅ 🚀 on supported platforms. Discord and Slack use similar :code: syntax but with their own emoji libraries, so the available codes differ.

3. HTML Entities

For maximum compatibility you can also use HTML entity codes, though shortcodes are far more readable.


HTML in Markdown

You can embed raw HTML inside markdown for cases the syntax does not cover:

<details>
<summary>Click to expand</summary>

This content is hidden by default and shown when the user clicks.

</details>

Common uses for raw HTML:

Keyboard Keys Example

Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.

Caveats

Some platforms strip or sanitise HTML for security (Reddit, for example). GitHub allows most HTML but blocks <script> and a few other tags. Always test on your target platform.


Escape Characters

To display a markdown character literally, prefix it with a backslash:

\* This is not italic \*
\# This is not a heading
\[This is not a link\](not-a-url)

Characters you can escape:

\ ` * _ {} [] () # + - . ! |


Math Equations (LaTeX)

Math is a popular GFM extension supported by GitHub, GitLab, Obsidian, Notion, and most modern documentation tools. Use LaTeX syntax inside dollar signs.

Inline Math

Single dollar signs for inline math:

The Pythagorean theorem is $a^2 + b^2 = c^2$.

GitHub also supports an alternate syntax using $` and `$ for cases where your math contains characters that conflict with markdown:

This price tag $`100 + 50 = 150`$ uses the alternate delimiters.

Block Math

Double dollar signs for block-level equations:

$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$

Common LaTeX Patterns

Fractions:        $\frac{a}{b}$
Square root:      $\sqrt{x}$
Powers:           $x^{2}$
Subscripts:       $x_{i}$
Greek letters:    $\alpha, \beta, \gamma, \pi, \theta$
Sum:              $\sum_{i=1}^{n} i$
Integral:         $\int_{0}^{1} x \, dx$
Matrix:           $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$

Renderers vary on syntax. GitHub uses MathJax. Some platforms require KaTeX which has slightly different conventions.


Mermaid Diagrams

Mermaid is a JavaScript library that turns text into diagrams. GitHub, GitLab, Notion, Obsidian, and most modern markdown renderers support it natively. It is one of the most useful features in modern markdown.

Flowchart

```mermaid
flowchart TD
    A[Start] --> B{Is it working?}
    B -->|Yes| C[Ship it]
    B -->|No| D[Debug]
    D --> B
```

Sequence Diagram

```mermaid
sequenceDiagram
    User->>Browser: Open .md file
    Browser->>Markdific: Render markdown
    Markdific-->>Browser: Return HTML
    Browser-->>User: Show formatted page
```

Other Mermaid Diagram Types

For more on Mermaid, read our complete guide to rendering Mermaid diagrams in markdown.


GitHub Alerts

GitHub Alerts (also called "callouts" or "admonitions") are a GFM feature launched by GitHub in December 2023. They render special blockquotes with icons and colours, and are now widely supported across other markdown renderers.

> [!NOTE]
> Useful information that users should know.

> [!TIP]
> Helpful advice for doing things better.

> [!IMPORTANT]
> Key information users need to know.

> [!WARNING]
> Urgent info that needs immediate attention.

> [!CAUTION]
> Advises about risks or negative outcomes.

The five supported types are NOTE, TIP, IMPORTANT, WARNING, and CAUTION. Other markdown tools (Obsidian, MkDocs, Docusaurus) use similar but slightly different syntax for callouts.


YAML Frontmatter

Frontmatter is a block of YAML metadata at the top of a markdown file, used by static site generators (Hugo, Jekyll, Astro, Next.js), CMS platforms, and note-taking apps.

---
title: "My Article Title"
date: 2026-01-15
author: Jane Doe
tags:
  - markdown
  - tutorial
  - reference
draft: false
description: A short summary for SEO.
---

# Article content starts here

Three hyphens open and close the block. Inside, use standard YAML syntax. Common fields:

Frontmatter is invisible in the rendered output. It is purely metadata for the system processing the file.

For a deeper dive, read our complete guide to YAML frontmatter.


Markdown Flavours Compared

Markdown has several "flavours" with different features. Knowing which one your target platform uses prevents broken rendering.

FlavourWhere UsedKey Features
CommonMarkReddit, Stack OverflowThe standardised core. Predictable but limited.
GitHub Flavored Markdown (GFM)GitHub, GitLab, most modern toolsCommonMark + tables, task lists, strikethrough, autolinks, footnotes, alerts
MultiMarkdownAcademic and technical writingAdds tables, footnotes, math, citations, metadata
Pandoc MarkdownPandoc converterMost powerful. Adds definition lists, math, tables, citations, raw HTML
Obsidian MarkdownObsidian note-taking appGFM + wikilinks [[note]], callouts, embeds, tags
R MarkdownR, RStudio, QuartoAdds executable code chunks for data analysis
Discord / SlackChat appsCustom subsets with platform-specific syntax (spoilers, mentions, emoji codes)

When in doubt, write GFM. It is the closest thing to a universal markdown standard in 2026.


Common Mistakes

These trip up writers constantly. Avoid them.

1. Forgetting Blank Lines

Markdown often needs a blank line between elements:

This is a paragraph.
- This list might not render
- depending on the renderer.

Fix with a blank line:

This is a paragraph.

- This list renders correctly.
- Every renderer agrees.

2. Mixing Indentation

When nesting lists or adding paragraphs to list items, use consistent indentation (2 or 4 spaces). Mixing tabs and spaces breaks rendering.

3. Trailing Whitespace for Line Breaks

The "two spaces at end of line" trick for soft line breaks is invisible and breaks easily. Use a backslash instead, or just accept that paragraphs are usually what you want.

4. Not Escaping Special Characters

Writing func_name_with_underscores in prose may render as italic in some parsers because underscores trigger emphasis. Wrap technical terms in backticks for inline code, or escape the underscores: func\_name\_with\_underscores. Other common collisions: < and > being read as HTML tags, and | inside table cells breaking the table layout.

5. Relying on Non-Standard Features

If you use Obsidian wikilinks [[note]] and then publish to a static site that does not support them, your links break. Know your target renderer.

6. Tables That Are Too Wide

GFM tables cannot scroll horizontally. If a table is too wide for the page, it overflows. Break wide tables into multiple narrower ones or use HTML.

7. Empty Headings or Headings With Only Formatting

## **Bold heading**

This works but some renderers strip the formatting from headings or generate weird anchor IDs. Keep headings plain.


Download the PDF Cheat Sheet

Want this cheat sheet offline? Download the printable PDF version (coming soon) to keep on your desk or share with your team.

Markdown Cheat Sheet PDF

The PDF includes every syntax example from this article in a print-friendly 2-page format. Perfect for sticking on the wall next to your monitor.

Download PDF — Coming Soon

Conclusion

That is every markdown syntax you will realistically encounter in 2026. The core takeaways:

The format will keep evolving as AI-generated content floods the web with .md files, but the core syntax has been stable since 2004 and will not change. Learn it once and it pays off for decades.

Want to see your markdown rendered cleanly? Check out our roundup of the best markdown viewers in 2026. For deeper dives into specific features, browse our markdown resources for guides on tables, images, frontmatter, and more.