Markdown Cheat Sheet: Complete Reference Guide
· 12 min read
Markdown has become the universal language of text formatting on the web. Whether you're writing documentation on GitHub, posting on Reddit, chatting on Discord, organizing notes in Notion, or creating content for countless other platforms, Markdown is everywhere. Learning this simple yet powerful syntax will make you more productive across every digital workspace you use.
This comprehensive guide covers everything from basic formatting to advanced techniques, complete with practical examples and real-world use cases. Bookmark this page as your go-to reference for all things Markdown.
📑 Table of Contents
- What is Markdown and Why Use It?
- Basic Text Formatting
- Headings and Document Structure
- Lists: Ordered, Unordered, and Nested
- Links and Images
- Code Blocks and Syntax Highlighting
- Creating Tables
- Blockquotes and Citations
- Advanced Markdown Features
- Markdown Flavors and Extensions
- Best Practices and Common Mistakes
- Frequently Asked Questions
What is Markdown and Why Use It?
Markdown is a lightweight markup language created by John Gruber in 2004. Its philosophy is simple: plain text should be readable as-is, but also convertible to HTML and other formats. Unlike rich text editors that hide formatting behind buttons and menus, Markdown keeps everything visible and portable.
The beauty of Markdown lies in its simplicity. You can write it in any text editor, version control it with Git, and convert it to HTML, PDF, or dozens of other formats. It's become the de facto standard for technical documentation, README files, blog posts, and collaborative writing.
Where Markdown is used:
- GitHub, GitLab, and Bitbucket for README files and documentation
- Reddit, Discord, and Slack for formatted messages
- Notion, Obsidian, and Roam Research for note-taking
- Static site generators like Jekyll, Hugo, and Gatsby
- Content management systems and blogging platforms
- Technical writing tools and documentation platforms
Pro tip: Use our free Markdown Editor to practice syntax in real-time with live preview. It's the fastest way to learn by doing.
Basic Text Formatting
Markdown's basic formatting syntax is intuitive and easy to remember. Most formatting uses special characters that surround the text you want to style.
Bold Text
Create bold text by wrapping words with double asterisks or double underscores:
**This text is bold**
__This is also bold__
Both produce: This text is bold
Italic Text
Use single asterisks or single underscores for italic text:
*This text is italic*
_This is also italic_
Both produce: This text is italic
Bold and Italic Combined
Combine both by using three asterisks or mixing asterisks and underscores:
***Bold and italic text***
**_Also bold and italic_**
Result: Bold and italic text
Strikethrough
Most Markdown flavors support strikethrough with double tildes:
~~This text is crossed out~~
Result: This text is crossed out
Inline Code
Wrap text in single backticks to format it as inline code:
Use the `console.log()` function to debug.
Result: Use the console.log() function to debug.
| Syntax | Output | Use Case |
|---|---|---|
**text** |
text | Emphasis, important terms |
*text* |
text | Subtle emphasis, book titles |
~~text~~ |
Deleted content, corrections | |
`text` |
text |
Code, commands, file names |
Headings and Document Structure
Headings create document hierarchy and improve readability. Markdown supports six levels of headings, matching HTML's <h1> through <h6> tags.
# Heading 1 (Largest)
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6 (Smallest)
The number of hash symbols determines the heading level. Always include a space between the hash symbols and the heading text.
Best practice: Use heading levels hierarchically. Don't skip from H1 to H4. This improves accessibility for screen readers and helps search engines understand your content structure.
Alternative Heading Syntax
For H1 and H2, you can also use underline-style syntax:
Heading 1
=========
Heading 2
---------
However, the hash symbol syntax is more common and supports all six levels.
Heading Best Practices
- Use only one H1 per document (typically the title)
- Keep headings concise and descriptive
- Use sentence case or title case consistently
- Don't end headings with punctuation
- Add blank lines before and after headings for readability
Lists: Ordered, Unordered, and Nested
Lists are fundamental to organizing information. Markdown supports unordered (bulleted) lists, ordered (numbered) lists, and nested combinations of both.
Unordered Lists
Create bulleted lists using asterisks, hyphens, or plus signs. All three produce identical output:
* First item
* Second item
* Third item
- First item
- Second item
- Third item
+ First item
+ Second item
+ Third item
Choose one style and stick with it throughout your document for consistency.
Ordered Lists
Number your list items with periods. The actual numbers don't matter—Markdown will renumber them automatically:
1. First item
2. Second item
3. Third item
1. First item
1. Second item
1. Third item
Both produce the same numbered list. Using all 1s makes it easier to reorder items without renumbering.
Nested Lists
Indent nested items with 2 or 4 spaces (be consistent):
1. First item
- Nested bullet
- Another nested bullet
2. Second item
1. Nested number
2. Another nested number
Task Lists
Many Markdown flavors support task lists with checkboxes:
- [x] Completed task
- [ ] Incomplete task
- [ ] Another incomplete task
This is particularly useful in GitHub issues and project management tools.
Quick tip: When writing multi-paragraph list items, indent subsequent paragraphs to align with the first line of text, not the bullet point.
Links and Images
Markdown makes it easy to add hyperlinks and images without cluttering your text with HTML tags.
Basic Links
The syntax for links is straightforward: square brackets for the link text, followed by parentheses for the URL:
[Visit our Markdown Editor](/tools/markdown-editor/)
Result: Visit our Markdown Editor
Links with Titles
Add a title attribute (shown on hover) by including it in quotes after the URL:
[GitHub](https://github.com "Visit GitHub")
Reference-Style Links
For documents with many repeated links, use reference-style syntax to keep your text clean:
Check out [Google][1] and [GitHub][2] for more info.
[1]: https://google.com "Google"
[2]: https://github.com "GitHub"
The reference definitions can appear anywhere in the document and won't be visible in the output.
Automatic Links
Wrap URLs or email addresses in angle brackets to make them clickable:
<https://example.com>
<email@example.com>
Many Markdown processors also auto-link bare URLs without angle brackets.
Images
Image syntax is identical to links, but with an exclamation mark prefix:


The alt text is crucial for accessibility and SEO. Always provide descriptive alt text that explains what the image shows.
Image Best Practices
- Write descriptive alt text for accessibility
- Use relative paths for images in the same repository
- Optimize image file sizes for faster loading
- Consider using reference-style syntax for repeated images
- Test that images display correctly in your target platform
Code Blocks and Syntax Highlighting
Code blocks are essential for technical documentation. Markdown provides multiple ways to format code, from inline snippets to multi-line blocks with syntax highlighting.
Inline Code
As mentioned earlier, wrap inline code in single backticks:
Use the `git commit` command to save changes.
Fenced Code Blocks
For multi-line code, use triple backticks (or triple tildes) before and after the code:
```
function greet(name) {
return `Hello, ${name}!`;
}
```
Syntax Highlighting
Specify the programming language after the opening backticks for syntax highlighting:
```javascript
function greet(name) {
return `Hello, ${name}!`;
}
```
```python
def greet(name):
return f"Hello, {name}!"
```
```css
.button {
background-color: #06b6d4;
border-radius: 8px;
}
```
Most Markdown processors support dozens of languages including JavaScript, Python, Java, C++, Ruby, Go, Rust, SQL, HTML, CSS, and many more.
Indented Code Blocks
An older syntax uses 4-space indentation to create code blocks:
function example() {
return true;
}
However, fenced code blocks are preferred because they support syntax highlighting and are easier to read in plain text.
Pro tip: Use our HTML Beautifier to format code before pasting it into Markdown documents. Clean, well-formatted code is easier to read and maintain.
Creating Tables
Tables organize data into rows and columns. While Markdown tables aren't as flexible as HTML tables, they're perfect for simple data presentation.
Basic Table Syntax
Create tables using pipes and hyphens:
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
The pipes don't need to align perfectly—Markdown processors will format them correctly. However, aligned pipes make tables easier to read in plain text.
Column Alignment
Control text alignment using colons in the separator row:
| Left-aligned | Center-aligned | Right-aligned |
|:-------------|:--------------:|--------------:|
| Text | Text | Text |
| More text | More text | More text |
:---aligns left (default):---:centers text---:aligns right
Practical Table Example
| Markdown Flavor | Tables | Task Lists | Footnotes |
|---|---|---|---|
| CommonMark | ❌ No | ❌ No | ❌ No |
| GitHub Flavored Markdown | ✅ Yes | ✅ Yes | ❌ No |
| Markdown Extra | ✅ Yes | ❌ No | ✅ Yes |
| MultiMarkdown | ✅ Yes | ❌ No | ✅ Yes |
Table Limitations and Workarounds
Markdown tables have some limitations compared to HTML tables:
- No cell spanning (rowspan/colspan)
- No nested formatting in some processors
- Limited styling options
- Can become unwieldy with many columns
For complex tables, consider using HTML directly within your Markdown document. Most processors allow this.
Blockquotes and Citations
Blockquotes highlight quoted text, important notes, or callout information. They're perfect for citations, testimonials, or emphasizing key points.
Basic Blockquotes
Start lines with a greater-than symbol:
> This is a blockquote.
> It can span multiple lines.
Result:
This is a blockquote. It can span multiple lines.
Nested Blockquotes
Add additional greater-than symbols for nested quotes:
> First level quote
> > Nested quote
> > > Deeply nested quote
Blockquotes with Other Elements
Blockquotes can contain other Markdown formatting:
> ## Heading in a blockquote
>
> This blockquote contains:
> - A list item
> - Another list item
>
> And **bold text** too.
Practical Use Cases
- Citations: Quote sources in research documents
- Testimonials: Highlight customer feedback
- Warnings: Draw attention to important notes
- Asides: Add supplementary information
- Pull quotes: Emphasize key points in articles
Advanced Markdown Features
Beyond the basics, Markdown supports several advanced features that enhance your documents. Availability varies by Markdown flavor.
Footnotes
Footnotes let you add references without cluttering your main text:
Here's a sentence with a footnote.[^1]
[^1]: This is the footnote content.
The footnote reference can appear anywhere in the document. Most processors automatically number footnotes and create backlinks.
Definition Lists
Some Markdown flavors support definition lists for term-definition pairs:
Term 1
: Definition 1
Term 2
: Definition 2a
: Definition 2b
Abbreviations
Define abbreviations that show full text on hover:
The HTML specification is maintained by W3C.
*[HTML]: Hyper Text Markup Language
*[W3C]: World Wide Web Consortium
Horizontal Rules
Create visual breaks with three or more hyphens, asterisks, or underscores:
---
***
___
All three produce a horizontal line. Add blank lines before and after for best compatibility.
Escaping Characters
Use backslashes to display literal Markdown characters:
\*This text is not italic\*
\[This is not a link\]
Common characters to escape: \ ` * _ { } [ ] ( ) # + - . !
HTML in Markdown
Most Markdown processors allow raw HTML for features Markdown doesn't support:
<div style="color: #06b6d4">
This text is styled with HTML.
</div>
Use HTML sparingly—it reduces portability and readability.
Quick tip: Test advanced features in your target platform before relying on them. Not all Markdown processors support every extension.
Markdown Flavors and Extensions
While basic Markdown syntax is standardized, many "flavors" add extra features. Understanding these differences helps you write compatible documents.
CommonMark
CommonMark is a strongly specified, highly compatible specification of Markdown. It aims to resolve ambiguities in the original Markdown specification and provide a standard that implementations can target.
CommonMark includes only core features and serves as a foundation for other flavors.
GitHub Flavored Markdown (GFM)
GFM is the most widely used Markdown flavor. It adds:
- Tables
- Task lists
- Strikethrough
- Autolinked URLs
- Emoji shortcodes (
:smile:→ 😊) - Username mentions (
@username) - Issue references (
#123)
GFM is used across GitHub, GitLab, and many other platforms.
Markdown Extra
Markdown Extra extends basic Markdown with:
- Footnotes
- Definition lists
- Tables
- Abbreviations
- Fenced code blocks
- Special attributes for headers and links
MultiMarkdown
MultiMarkdown adds features for academic writing:
- Footnotes
- Tables
- Citations and bibliography
- Math support
- Metadata (title, author, date)
- Cross-references
Choosing the Right Flavor
Your choice depends on your use case:
- GitHub/GitLab: Use GFM
- Static site generators: Check documentation (often GFM or CommonMark)
- Academic writing: Consider MultiMarkdown or Pandoc
- Maximum compatibility: Stick to CommonMark basics
- Note-taking apps: Check app documentation for supported features
Best Practices and Common Mistakes
Following best practices ensures your Markdown is readable, maintainable, and compatible across platforms.
Formatting Best Practices
- Blank lines: Add blank lines between different elements (paragraphs, lists, code blocks)
- Consistency: Choose one style for lists, emphasis, and headings—stick with it
- Line length: Keep lines under 80-100 characters for better diff viewing
- Indentation: Use consistent indentation (2 or 4 spaces) for nested elements
- Trailing spaces: Avoid trailing spaces except for line breaks (two spaces)
Common Mistakes to Avoid
Missing spaces after hash symbols:
❌ #Heading
✅ # Heading
Inconsistent list markers:
❌ * Item 1
- Item 2
+ Item 3
✅ * Item 1
* Item 2
* Item 3
Skipping heading levels:
❌ # H1
#### H4
✅ # H1
## H2
### H3
Forgetting alt text for images:
❌ 
✅ 
Accessibility Considerations
- Always provide descriptive alt text for images
- Use heading hierarchy correctly for screen readers
- Write descriptive link text (avoid "click here")
- Ensure sufficient color contrast in any custom styling
- Test your rendered Markdown with accessibility tools
Version Control Tips
When using Markdown with Git:
- Keep lines short for better diffs
- Put each sentence on its own line
- Use reference-style links to reduce diff noise
- Add a
.editorconfigfile to enforce consistent formatting - Consider using a Markdown linter in your CI/CD pipeline
Pro tip: Use a Markdown linter like markdownlint to catch formatting issues automatically. Many editors have plugins that highlight problems as you type.
Frequently Asked Questions
What's the difference between Markdown and HTML?
Markdown is a lightweight markup language designed for readability in plain text form. It converts to HTML but is much simpler to write and read. HTML offers more control and features, but Markdown is faster for common formatting tasks. Many writers use Markdown for content and fall back to HTML only when needed for specific styling or functionality.
Can I use Markdown for professional documentation?
Absolutely. Markdown is widely used for professional documentation, technical writing, and API documentation. Major companies like GitHub, Microsoft, and Amazon use Markdown for their documentation. Tools like MkDocs, Docusaurus, and GitBook build entire documentation sites from Markdown files. The key is choosing the right Markdown flavor and tooling for your needs.
How do I convert Markdown to other formats?
Many tools convert Markdown to HTML, PDF, Word documents, and more. Pandoc is the most powerful converter, supporting dozens of formats. For HTML conversion, most static site generators and Markdown processors handle this automatically. Our Markdown Editor provides instant HTML preview. For PDFs,