# The Complete Guide to Markdown Syntax
Markdown is a lightweight markup language that makes it easy to write formatted text. Whether you're writing documentation, blog posts, or README files, understanding markdown syntax is essential. This comprehensive guide will take you through everything from basic formatting to advanced features.
What is Markdown?
Markdown was created by John Gruber in 2004 as a simple, readable format that converts easily to HTML. It's now used everywhere—from GitHub and Reddit to Slack and Discord. The beauty of markdown lies in its simplicity: the syntax is intuitive and readable even in plain text form.
Basic Formatting
Headings
Markdown supports six levels of headings, from h1 to h6:
# This is H1
## This is H2
### This is H3
#### This is H4
##### This is H5
###### This is H6Use headings to structure your content hierarchically. H1 should typically be used once per document for the main title.
Text Styling
You can emphasize text in several ways:
- **Bold text** uses double asterisks or underscores: `**bold**` or `__bold__`
- *Italic text* uses single asterisks or underscores: `*italic*` or `_italic_`
- ***Bold and italic*** combines both: `***text***`
- ~~Strikethrough~~ uses double tildes: `~~strikethrough~~`
Paragraphs and Line Breaks
Separate paragraphs with blank lines. For line breaks within a paragraph, end the line with two spaces or use `<br>`.
Lists
Unordered Lists
Create unordered lists using hyphens, asterisks, or plus signs:
- Item 1
- Item 2
- Nested item 2a
- Nested item 2b
- Item 3Ordered Lists
For ordered lists, use numbers followed by periods:
1. First item
2. Second item
3. Third itemTask Lists
GitHub-flavored markdown supports task lists:
- [x] Completed task
- [ ] Incomplete task
- [x] Another done taskCode
Inline Code
Wrap code in backticks for inline formatting:
Use `const x = 42;` for inline code.Code Blocks
For longer code snippets, use triple backticks with optional language specification:
function greet(name) {
return `Hello, ${name}!`;
}Links and Images
Links
Create links with square brackets for text and parentheses for the URL:
[Link text](https://example.com)
[Link with title](https://example.com "Page title")Images
Images use similar syntax but with an exclamation mark prefix:

Blockquotes
Use the greater-than symbol to create blockquotes:
> This is a blockquote
>
> It can span multiple paragraphsHorizontal Rules
Create a horizontal line with three or more hyphens, asterisks, or underscores:
---
***
___Tables
GitHub flavored markdown supports tables:
| Header 1 | Header 2 |
| -------- | -------- |
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |Advanced Features
Escaped Characters
Escape special markdown characters with backslashes:
\* This won't be italic \*
\[Not a link\](example.com)HTML
You can include raw HTML in markdown for advanced formatting:
<div style="color: red;">This is red HTML text</div>Autolinks
URLs and email addresses in angle brackets automatically become links:
<https://example.com>
<user@example.com>Best Practices
1. **Use consistent formatting** - Pick a style and stick with it 2. **Keep code readable** - Format code blocks with appropriate language tags 3. **Structure with headings** - Use heading hierarchy logically 4. **Add emphasis sparingly** - Don't overuse bold and italic 5. **Use lists effectively** - Break up long paragraphs with lists 6. **Link generously** - Provide context with relevant links 7. **Write clean markdown** - Your raw markdown should be readable too
Conclusion
Markdown is a versatile tool that makes writing for the web faster and easier. By mastering these syntax elements, you'll be able to create professional, well-formatted documents across any platform that supports markdown. Start with the basics and gradually explore more advanced features as your needs grow.
Happy writing!