Skip to main content

Quick reference

Markdown cheat sheet

Markdown formats plain text with a few symbols: # for headings, ** for bold, - for lists, [text](url) for links, and backticks for code. Every example below shows the syntax next to the GitHub-style result, rendered by the same engine as the editor.

By Ayush Agarwal · Published · Updated

Markdown syntax quick reference

The most common Markdown elements on one screen. Scroll down for rendered examples of each.

Markdown syntax quick reference: element and the syntax that creates it
ElementMarkdown syntax
Heading# H1 ## H2 ### H3
Bold**bold text**
Italic*italic text*
Strikethrough~~deleted~~
Link[title](https://example.com)
Image![alt text](image.png)
Inline code`code`
Code block```js … ```
Blockquote> quoted text
Unordered list- item
Ordered list1. item
Task list- [ ] to do - [x] done
Table| A | B | then | --- | --- |
Horizontal rule---
Footnotetext[^1] [^1]: note
Inline math$E = mc^2$
Block math$$ … $$
Escape a character\*not italic\*

Headings, emphasis, and paragraphs

Start with the building blocks for readable Markdown documents. Leave a blank line between paragraphs.

Headings

Markdown

# Heading 1
## Heading 2
### Heading 3
#### Heading 4

Preview

Emphasis

Markdown

**Bold text**

*Italic text*

***Bold and italic***

~~Strikethrough~~

Preview

Blockquotes

Markdown

> Markdown keeps plain text readable.
>
> > Nest a quote with a second marker.

Preview

Line breaks and rules

Markdown

First line\
Second line, same paragraph

---

A new section after a horizontal rule.

Preview

Square brackets hold the visible text; parentheses hold the URL. Images use the same pattern with a leading exclamation mark.

Images

Markdown

![Markdown Lens icon](https://markdownlens.ayushdev.com/icon-192.png)

![Alt text describes the image](image.png "Optional title")

Preview

Lists and task lists

Indent by two or more spaces to nest. Square brackets after a list marker create a checklist.

Ordered and unordered lists

Markdown

- First item
- Second item
  - Nested item

1. Plan
2. Write
3. Review

Preview

Task lists

Markdown

- [x] Draft the README
- [ ] Add examples
- [ ] Request review

Preview

Tables

Separate the header with dashes and columns with vertical bars. Colons in the divider row set alignment.

Table with column alignment

Markdown

| Left | Center | Right |
| :--- | :---: | ---: |
| Tables | Ready | 1 |
| Mermaid | Ready | 2 |
| Math | Ready | 3 |

Preview

Have the data in a spreadsheet already? The CSV to Markdown table converter and Excel to Markdown converter build the table for you.

Code

Use single backticks for inline code and triple backticks for fenced blocks. Add a language name for syntax highlighting.

Inline code

Markdown

Run `npm run dev` to start the app.

Preview

Fenced code block

Markdown

```ts
const greeting = "Hello, Markdown!";
console.log(greeting);
```

Preview

Footnotes and escaping

Footnotes collect references at the end of the document. A backslash prints a Markdown symbol literally.

Footnotes

Markdown

Markdown was created in 2004.[^1]

[^1]: By John Gruber, with Aaron Swartz.

Preview

Escaping characters

Markdown

\*Not italic\* and \# not a heading.

Use \\ for a literal backslash.

Preview

Math and LaTeX

Markdown Lens renders KaTeX-compatible math. Use single dollar signs inline and double dollar signs for display equations.

Inline and block math

Markdown

Inline: $E = mc^2$

Block:
$$
\int_0^1 x^2\,dx = \frac{1}{3}
$$

Preview

Fractions, sums, and Greek letters

Markdown

$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$

$\alpha + \beta \le \sqrt{x_1^2 + x_2^2}$

Preview

Matrices

Markdown

$$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
$$

Preview

Aligned equations

Markdown

$$
\begin{aligned}
f(x) &= (x + 1)^2 \\
     &= x^2 + 2x + 1
\end{aligned}
$$

Preview

Mermaid diagrams

A fenced block with the mermaid language becomes a diagram in Markdown Lens and on GitHub.

Flowchart

Markdown

```mermaid
flowchart LR
  A[Write] --> B[Preview]
  B --> C[Publish]
```

Preview

Sequence diagram

Markdown

```mermaid
sequenceDiagram
  Writer->>Editor: Type Markdown
  Editor-->>Writer: Live preview
```

Preview

Markdown syntax questions

Short answers to the questions people ask most when writing Markdown.

What is a Markdown cheat sheet?

A Markdown cheat sheet is a one-page reference of Markdown syntax: the characters you type for headings, emphasis, lists, links, images, code, and tables. This page shows each pattern next to its rendered GitHub-style output so you can copy what you need.

Which Markdown flavor does this cheat sheet use?

GitHub-flavored Markdown (GFM). It covers the CommonMark basics plus GFM tables, task lists, strikethrough, autolinks, and footnotes. Math and Mermaid examples work in Markdown Lens and on GitHub, but not in every Markdown renderer.

How do I make a line break in Markdown?

End the line with a backslash or two trailing spaces, then continue on the next line. A blank line between lines starts a new paragraph instead.

How do I align columns in a Markdown table?

Add colons to the divider row: :--- aligns left, :---: centers, and ---: aligns right.

How do I write math or LaTeX in Markdown?

Wrap inline math in single dollar signs, like $a^2 + b^2 = c^2$, and put block equations between lines containing only $$. Markdown Lens renders both with KaTeX, which supports most common LaTeX math commands.

How do I show a literal asterisk, underscore, or pound sign?

Put a backslash in front of it, for example \* or \#. Markdown then prints the character instead of treating it as formatting.

Try the syntax in the editor

Open any example above to edit it, or convert an existing document into Markdown.