Markdown Syntax Guide: From Basics to Advanced Formatting

Markdown is the universal language for writing formatted text. It's used in GitHub READMEs, documentation sites, Notion, Slack, Jupyter notebooks, static site generators, and countless other tools. Once you learn the syntax, you'll use it everywhere.

Headings

Use # symbols for headings level 1–6:

# Heading 1       (largest)
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6   (smallest)
💡 Best Practice: Use only one # H1 per document (the title). Start content sections with ## H2. Skip levels sparingly — don't jump from H2 to H4.

Text Formatting

**bold text**              → bold text
*italic text*              → italic text
***bold and italic***      → bold and italic
~~strikethrough~~          → strikethrough
`inline code`              → inline code
> blockquote               → indented quote block
---                        → horizontal rule

Escaping special characters

Prefix with backslash to show literal characters:

\*not italic\*     → *not italic*
\# not a heading   → # not a heading
\[not a link\]     → [not a link]

Links & Images

# Inline link
[Link text](https://example.com)

# Link with title (shows on hover)
[Link text](https://example.com "Hover title")

# Reference-style link (cleaner for repeated URLs)
[Link text][1]
[Another link][1]
[1]: https://example.com "Reference URL"

# Auto-link
<https://example.com>

# Image
![Alt text](image.png)

# Image with title
![Alt text](image.png "Image title")

# Linked image (clickable)
[![Alt text](image.png)](https://example.com)

Lists

Unordered lists

- Item one
- Item two
  - Nested item (2 spaces indent)
  - Another nested
- Item three

* Also works with asterisks
+ And plus signs

Ordered lists

1. First item
2. Second item
3. Third item

# Auto-numbering (all 1s — Markdown renumbers automatically)
1. First item
1. Second item
1. Third item

Task lists (GFM)

- [x] Completed task
- [ ] Incomplete task
- [ ] Another todo

Code

Inline code

Use `console.log()` to debug.
Use ``code with `backtick` inside`` (double backticks).

Code blocks

```javascript
function greet(name) {
  return `Hello, ${name}!`;
}
```

```python
def greet(name):
    return f"Hello, {name}!"
```

```bash
npm install markdown-it
```

Specify the language after the opening backticks for syntax highlighting. Common language identifiers: javascript, python, bash, html, css, json, sql, yaml, typescript, java, c, cpp, go, rust.

Tables

| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Row 1    | Data     | Data     |
| Row 2    | Data     | Data     |

# Alignment
| Left     | Center   | Right    |
|:---------|:--------:|---------:|
| aligned  | aligned  | aligned  |

Use :--- for left align, :---: for center, ---: for right align.

💡 Tip: Tables don't need perfect column alignment in source — the pipes just need to be present. Most editors auto-format them.

Blockquotes

> Simple blockquote

> Multi-line blockquote
> continues on next line

> Nested blockquote
>> Deeper level
>>> Even deeper

> **Formatted** text inside blockquotes works:
> - Lists too
> - `code` as well

Extended Syntax (GitHub Flavored Markdown)

These features are supported by GitHub, GitLab, and most modern Markdown processors:

Footnotes

Here's a statement with a footnote.[^1]

[^1]: This is the footnote content.

Definition lists

Term
: Definition of the term

Another term
: Its definition

Alerts / Admonitions (GitHub)

> [!NOTE]
> Useful information the reader should know.

> [!WARNING]
> Critical content requiring immediate attention.

> [!TIP]
> Optional advice to help the reader succeed.

Collapsed sections

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

Hidden content goes here.
- Supports Markdown inside
- Including `code` and **formatting**

</details>

Emoji

:rocket: :star: :white_check_mark: :warning:
🚀 ⭐ ✅ ⚠️

Markdown Flavors

FlavorUsed ByExtra Features
CommonMarkStandard specificationCore syntax only
GFMGitHub, GitLabTables, task lists, alerts, autolinks
MDXDocusaurus, Next.jsJSX components in Markdown
MultiMarkdownAcademic writingCitations, footnotes, math
R MarkdownR / data scienceCode execution, plots

Quick Reference

ELEMENT             SYNTAX
──────────────────  ──────────────────────────
Bold                **text**
Italic              *text*
Code (inline)       `code`
Code block          ```lang ... ```
Link                [text](url)
Image               ![alt](url)
Heading             # H1  ## H2  ### H3
Unordered list      - item
Ordered list        1. item
Task list           - [x] done  - [ ] todo
Blockquote          > text
Table               | col | col |
Horizontal rule     ---
Footnote            text[^1]  [^1]: note
Escape              \*literal asterisks\*

Try your Markdown live — convert it to clean HTML instantly.

Open Markdown to HTML →