Markdown Cheat Sheet: Complete Syntax Guide

· 8 min read

What Is Markdown?

Markdown is a lightweight markup language created by John Gruber in 2004 that lets you format plain text using simple, intuitive syntax. It's the de facto standard for writing documentation, README files, blog posts, forum comments, and notes across the entire tech ecosystem.

What makes Markdown special is its readability—the source text is easily readable even without rendering. A Markdown file looks clean and logical in plain text, unlike HTML which is cluttered with tags. This makes it ideal for writing and collaboration.

Markdown is used everywhere: GitHub, GitLab, Reddit, Stack Overflow, Discord, Notion, Obsidian, Jupyter Notebooks, and millions of static sites. Convert your Markdown to HTML instantly with our Markdown to HTML converter.

Headings

Headings use hash symbols (#). The number of hashes determines the heading level (1-6):

# Heading 1 (H1)
## Heading 2 (H2)
### Heading 3 (H3)
#### Heading 4 (H4)
##### Heading 5 (H5)
###### Heading 6 (H6)

# Alternative syntax for H1 and H2:
Heading 1
=========

Heading 2
---------

Best practices: Use only one H1 per document (the title). Structure content hierarchically—don't skip levels (e.g., H2 to H4). Keep headings concise and descriptive for both readability and SEO.

Text Formatting

Markdown provides several ways to emphasize and format text:

**Bold text** or __Bold text__
*Italic text* or _Italic text_
***Bold and italic*** or ___Bold and italic___
~~Strikethrough text~~
`Inline code`
> Blockquote
>> Nested blockquote

---   (Horizontal rule)
***   (Horizontal rule, alternative)
___   (Horizontal rule, alternative)

Superscript: X^2^ (some parsers)
Subscript: H~2~O (some parsers)
==Highlighted text== (some parsers)


\*Escaped asterisks\* (backslash escapes special characters)

📝 Try it yourself

Markdown to HTML → Word Counter →
# Inline links
[Link text](https://example.com)
[Link with title](https://example.com "Title text")

# Reference links (cleaner for repeated URLs)
[Link text][ref-id]
[ref-id]: https://example.com "Optional title"

# Auto-links
<https://example.com>
<[email protected]>

# Images
![Alt text](image.jpg)
![Alt text](image.jpg "Image title")

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

# Reference-style image
![Alt text][img-id]
[img-id]: image.jpg "Title"

Lists

# Unordered lists (use -, *, or +)
- Item one
- Item two
  - Nested item (2-space indent)
  - Another nested
    - Deep nesting
- Item three

# Ordered lists
1. First item
2. Second item
3. Third item

# Mixed nesting
1. First item
   - Sub-item A
   - Sub-item B
2. Second item

# Task lists (GitHub Flavored Markdown)
- [x] Completed task
- [ ] Uncompleted task
- [ ] Another pending task

# Definition lists (some parsers)
Term
: Definition of the term

Code and Code Blocks

Markdown excels at displaying code, making it the preferred format for technical documentation:

# Inline code
Use the `console.log()` function to debug.

# Fenced code blocks (triple backticks)
```javascript
function greet(name) {
  return `Hello, ${name}!`;
}
```

# Fenced code with filename (some parsers)
```python title="app.py"
from flask import Flask
app = Flask(__name__)
```

# Indented code blocks (4 spaces or 1 tab)
    function example() {
      return true;
    }

# Common language identifiers for syntax highlighting:
# javascript, python, bash, html, css, json, sql,
# typescript, java, go, rust, ruby, php, swift, kotlin

Tables

Tables use pipes (|) and hyphens (-) to create structured data:

# Basic table
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |

# Column alignment
| Left     | Center   | Right    |
|:---------|:--------:|---------:|
| text     | text     | text     |

# Minimum syntax (outer pipes optional)
Header 1 | Header 2
--- | ---
Cell 1 | Cell 2

# Tips: Use a Markdown table generator for complex tables
# You can include inline formatting in cells:
| Feature | Status |
|---------|--------|
| **Bold** | `code` |
| *Italic* | ~~struck~~ |

For long documents, check word count with our Word Counter tool to ensure your content meets target lengths.

GitHub Flavored Markdown (GFM)

GitHub Flavored Markdown extends standard Markdown with additional features widely supported across platforms:

Task Lists

- [x] Design homepage
- [x] Implement responsive layout
- [ ] Write unit tests
- [ ] Deploy to production

Autolinked References

# GitHub auto-links these references
Issue: #123
PR: user/repo#456
Commit: a1b2c3d
User: @username

Footnotes

Here is a statement with a footnote.[^1]

[^1]: This is the footnote content.

Alerts/Callouts (GitHub)

> [!NOTE]
> Useful information for users.

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

> [!WARNING]
> Critical information requiring attention.

> [!CAUTION]
> Potential negative consequences of an action.

Emoji

:smile: :rocket: :tada: :warning: :heart:
# Renders as: 😄 🚀 🎉 ⚠️ ❤️

Key Takeaways

Related Tools

Markdown to HTML Word Counter
We use cookies for analytics. By continuing, you agree to our Privacy Policy.