Basic Markdown Syntax
Learn all the fundamental Markdown formatting: headings, text styling, links, images, lists, blockquotes, code, and horizontal rules. Each element includes the Markdown source and its rendered output.
Headings
Create headings using the hash symbol (#). The number of hashes determines the heading level (1-6).
# Heading 1 <!-- Largest --> ## Heading 2 ### Heading 3 #### Heading 4 ##### Heading 5 ###### Heading 6 <!-- Smallest -->
Paragraphs and Line Breaks
This is the first paragraph. It can span multiple lines in the source file and will render as a single paragraph. This is the second paragraph. Separate paragraphs with a blank line between them. For a line break without a new paragraph, end a line with two spaces or use a backslash \ at the end of the line.
Text Styling
**bold text** or __bold text__ *italic text* or _italic text_ ***bold and italic*** or ___bold and italic___ ~~strikethrough~~ (needs GFM support)
Links
# Inline link [Link text](https://example.com) # Link with title (hover text) [Link text](https://example.com "Title text") # Reference-style link (cleaner for multiple uses) [Link text][ref-id] # Define reference elsewhere in the document [ref-id]: https://example.com "Optional title" # Autolink (URL displayed as-is) <https://example.com> # Email link <user@example.com>
Images
# Inline image  # Image with title  # Reference-style image ![Alt text][img-ref] [img-ref]: image-url.png "Title" # Linked image (clickable) [](https://example.com)
Lists
# Unordered list (use -, *, or +) - Item one - Item two - Nested item - Another nested item - Item three # Ordered list 1. First item 2. Second item 1. Sub-item one 2. Sub-item two 3. Third item # Mixed list 1. First ordered item - Unordered sub-item - Another sub-item 2. Second ordered item
Blockquotes
> This is a blockquote. It can span > multiple lines. > Blockquotes can contain **formatting**, > [links](https://example.com), and other > Markdown elements. > Nested blockquotes: >> Use multiple > characters >> for deeper nesting.
Horizontal Rules
# Any of these create a horizontal rule: --- *** ___
Code
# Inline code Use the `print()` function to display output. # Code block (indented with 4 spaces or 1 tab) function hello() { console.log("Hello!"); } # Fenced code block (preferred method) ```javascript function hello() { console.log("Hello!"); } ``` # Common language identifiers: # ```python ```javascript ```typescript # ```bash ```json ```html # ```css ```sql ```yaml
Escape Characters
Use a backslash (\) to display characters that would otherwise be interpreted as Markdown formatting:
\*Not italic\* # Shows: *Not italic* \# Not a heading # Shows: # Not a heading \[Not a link\] # Shows: [Not a link] # Characters you can escape: \ ` * _ {} [] () # + - . ! |
Quick Reference
| Element | Markdown Syntax |
|---|---|
| Heading | # H1 through ###### H6 |
| Bold | **text** |
| Italic | *text* |
| Strikethrough | ~~text~~ |
| Link | [text](url) |
| Image |  |
| Unordered List | - item |
| Ordered List | 1. item |
| Blockquote | > text |
| Inline Code | `code` |
| Code Block | ```lang ... ``` |
| Horizontal Rule | --- |
Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX