Headings
Markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4Preview
Quick reference
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
The most common Markdown elements on one screen. Scroll down for rendered examples of each.
| Element | Markdown syntax |
|---|---|
| Heading | # H1 ## H2 ### H3 |
| Bold | **bold text** |
| Italic | *italic text* |
| Strikethrough | ~~deleted~~ |
| Link | [title](https://example.com) |
| Image |  |
| Inline code | `code` |
| Code block | ```js … ``` |
| Blockquote | > quoted text |
| Unordered list | - item |
| Ordered list | 1. item |
| Task list | - [ ] to do - [x] done |
| Table | | A | B | then | --- | --- | |
| Horizontal rule | --- |
| Footnote | text[^1] [^1]: note |
| Inline math | $E = mc^2$ |
| Block math | $$ … $$ |
| Escape a character | \*not italic\* |
Start with the building blocks for readable Markdown documents. Leave a blank line between paragraphs.
Markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4Preview
Markdown
**Bold text**
*Italic text*
***Bold and italic***
~~Strikethrough~~Preview
Bold text
Italic text
Bold and italic
Strikethrough
Markdown
> Markdown keeps plain text readable.
>
> > Nest a quote with a second marker.Preview
Markdown keeps plain text readable.
Nest a quote with a second marker.
Markdown
First line\
Second line, same paragraph
---
A new section after a horizontal rule.Preview
First line
Second line, same paragraph
A new section after a horizontal rule.
Square brackets hold the visible text; parentheses hold the URL. Images use the same pattern with a leading exclamation mark.
Markdown
[Markdown Lens](https://markdownlens.ayushdev.com)
Read the [spec][gfm].
https://github.com is linked automatically.
[gfm]: https://github.github.com/gfm/Preview
Markdown Lens (opens in a new tab)
Read the spec (opens in a new tab).
https://github.com (opens in a new tab) is linked automatically.
Markdown

Preview
Remote image blocked from markdownlens.ayushdev.com (Markdown Lens icon)
Image source blocked (Alt text describes the image)
Indent by two or more spaces to nest. Square brackets after a list marker create a checklist.
Markdown
- First item
- Second item
- Nested item
1. Plan
2. Write
3. ReviewPreview
Markdown
- [x] Draft the README
- [ ] Add examples
- [ ] Request reviewPreview
Separate the header with dashes and columns with vertical bars. Colons in the divider row set alignment.
Markdown
| Left | Center | Right |
| :--- | :---: | ---: |
| Tables | Ready | 1 |
| Mermaid | Ready | 2 |
| Math | Ready | 3 |Preview
| Left | Center | Right |
|---|---|---|
| Tables | Ready | 1 |
| Mermaid | Ready | 2 |
| Math | Ready | 3 |
Have the data in a spreadsheet already? The CSV to Markdown table converter and Excel to Markdown converter build the table for you.
Use single backticks for inline code and triple backticks for fenced blocks. Add a language name for syntax highlighting.
Markdown
Run `npm run dev` to start the app.Preview
Run npm run dev to start the app.
Markdown
```ts
const greeting = "Hello, Markdown!";
console.log(greeting);
```Preview
const greeting = "Hello, Markdown!";
console.log(greeting);
Footnotes collect references at the end of the document. A backslash prints a Markdown symbol literally.
Markdown
\*Not italic\* and \# not a heading.
Use \\ for a literal backslash.Preview
*Not italic* and # not a heading.
Use \ for a literal backslash.
Markdown Lens renders KaTeX-compatible math. Use single dollar signs inline and double dollar signs for display equations.
Markdown
Inline: $E = mc^2$
Block:
$$
\int_0^1 x^2\,dx = \frac{1}{3}
$$Preview
Inline:
Block:
Markdown
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
$\alpha + \beta \le \sqrt{x_1^2 + x_2^2}$Preview
Markdown
$$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
$$Preview
Markdown
$$
\begin{aligned}
f(x) &= (x + 1)^2 \\
&= x^2 + 2x + 1
\end{aligned}
$$Preview
A fenced block with the mermaid language becomes a diagram in Markdown Lens and on GitHub.
Markdown
```mermaid
flowchart LR
A[Write] --> B[Preview]
B --> C[Publish]
```Preview
Markdown
```mermaid
sequenceDiagram
Writer->>Editor: Type Markdown
Editor-->>Writer: Live preview
```Preview
Short answers to the questions people ask most when writing Markdown.
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.
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.
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.
Add colons to the divider row: :--- aligns left, :---: centers, and ---: aligns right.
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.
Put a backslash in front of it, for example \* or \#. Markdown then prints the character instead of treating it as formatting.
Open any example above to edit it, or convert an existing document into Markdown.