Basic Markdown Syntax

Master the essential Markdown elements that work in all applications. These are the building blocks of Markdown formatting.

Jump to Section

Headers

Create headings using hash symbols (#). The number of hashes determines the heading level.

Basic Headers

Markdown
# H1 Heading
## H2 Heading  
### H3 Heading
#### H4 Heading
##### H5 Heading
###### H6 Heading
Preview

H1 Heading

H2 Heading

H3 Heading

H4 Heading

H5 Heading
H6 Heading

Use one to six # symbols for different heading levels. Always add a space after the #.

Alternative Syntax

Markdown
H1 Alternative
===============

H2 Alternative
---------------
Preview

H1 Alternative

H2 Alternative

You can also use = for H1 and - for H2 headers. This syntax only works for H1 and H2.

Tips & Best Practices

  • Always put a space between the # and the header text
  • Try to skip heading levels (don't go from H1 to H3)
  • Use only one H1 per document for better SEO
  • Keep headers descriptive and concise

Paragraphs

Create paragraphs by separating text with blank lines.

Basic Paragraphs

Markdown
This is the first paragraph.

This is the second paragraph.

This is the third paragraph.
Preview

This is the first paragraph.

This is the second paragraph.

This is the third paragraph.

Use a blank line to separate paragraphs. Don't indent paragraphs with spaces or tabs.

Tips & Best Practices

  • Don't indent paragraphs with spaces or tabs
  • Use blank lines to separate paragraphs
  • Keep paragraphs focused on a single idea

Line Breaks

Create line breaks within paragraphs using two or more spaces at the end of a line.

Hard Line Breaks

Markdown
This is the first line.  
This is the second line.

This is another paragraph.  
With a line break.
Preview

This is the first line.
This is the second line.

This is another paragraph.
With a line break.

Add two or more spaces at the end of a line, then press Enter to create a line break.

HTML Alternative

Markdown
This is the first line.<br>
This is the second line.
Preview

This is the first line.<br> This is the second line.

You can also use HTML <br> tags for line breaks.

Tips & Best Practices

  • Use two or more spaces at the end of a line for line breaks
  • Consider using HTML <br> tags for better visibility
  • Use line breaks sparingly for better readability

Bold & Italic

Emphasize text using asterisks (*) or underscores (_).

Bold Text

Markdown
**This text is bold**
__This is also bold__
Preview

This text is bold This is also bold

Use two asterisks or underscores around text to make it bold.

Italic Text

Markdown
*This text is italic*
_This is also italic_
Preview

This text is italic This is also italic

Use single asterisks or underscores around text to make it italic.

Bold and Italic

Markdown
***This text is bold and italic***
___This is also bold and italic___
**_Mix and match_**
*__Also works__*
Preview

This text is bold and italic This is also bold and italic Mix and match Also works

Combine bold and italic by using three asterisks/underscores or mixing them.

Tips & Best Practices

  • Asterisks are generally preferred over underscores
  • Be consistent with your choice throughout the document
  • Use emphasis sparingly for maximum impact

Blockquotes

Create blockquotes using the greater than symbol (>).

Basic Blockquote

Markdown
> This is a blockquote.
> It can span multiple lines.
Preview

This is a blockquote. It can span multiple lines.

Use > at the beginning of each line for blockquotes.

Nested Blockquotes

Markdown
> This is a blockquote.
>
>> This is a nested blockquote.
>
> Back to the first level.
Preview

This is a blockquote.

This is a nested blockquote.

Back to the first level.

Use >> for nested blockquotes. Add blank lines for better separation.

Blockquotes with Other Elements

Markdown
> ## This is a header in a blockquote
>
> This is a paragraph in a blockquote.
>
> - This is a list item
> - This is another list item
Preview

This is a header in a blockquote

This is a paragraph in a blockquote.

  • This is a list item
  • This is another list item

You can include other Markdown elements inside blockquotes.

Tips & Best Practices

  • Use blockquotes for quotes, notes, or warnings
  • Add blank lines around blockquotes for better readability
  • You can nest blockquotes for different levels of emphasis

Lists

Create ordered and unordered lists using numbers or symbols.

Unordered Lists

Markdown
- First item
- Second item
- Third item

* First item
* Second item  
* Third item

+ First item
+ Second item
+ Third item
Preview
  • First item
  • Second item
  • Third item
  • First item
  • Second item
  • Third item
  • First item
  • Second item
  • Third item

Use -, *, or + for unordered lists. Be consistent within each list.

Ordered Lists

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

1. First item
8. Second item (number doesn't matter)
3. Third item
Preview
  1. First item

  2. Second item

  3. Third item

  4. First item

  5. Second item (number doesn't matter)

  6. Third item

Use numbers followed by periods. The actual numbers don't need to be in order.

Nested Lists

Markdown
1. First item
   - Nested item
   - Another nested item
2. Second item
   1. Ordered nested item
   2. Another ordered nested item
Preview
  1. First item
    • Nested item
    • Another nested item
  2. Second item
    1. Ordered nested item
    2. Another ordered nested item

Indent nested list items with 2-4 spaces or one tab.

Lists with Multiple Paragraphs

Markdown
1. First item

   This is a paragraph under the first item.

2. Second item

   This is a paragraph under the second item.
   
   - Nested list item
   - Another nested list item
Preview
  1. First item

    This is a paragraph under the first item.

  2. Second item

    This is a paragraph under the second item.

    • Nested list item
    • Another nested list item

Indent paragraphs under list items to keep them part of the list.

Tips & Best Practices

  • Use consistent indentation (2-4 spaces) for nested lists
  • Add blank lines around lists for better readability
  • You can mix ordered and unordered lists in nesting

Code

Display code using backticks (`) for inline code or triple backticks for code blocks.

Inline Code

Markdown
Use `console.log()` to print to the console.

The `git status` command shows the status of your repository.
Preview

Use console.log() to print to the console.

The git status command shows the status of your repository.

Use single backticks around inline code. The code will be highlighted differently from regular text.

Code Blocks

Markdown
```
function greet(name) {
  return "Hello, " + name + "!";
}
```
Preview
function greet(name) {
  return "Hello, " + name + "!";
}

Use triple backticks for code blocks. The code will be displayed in a separate block.

Code Blocks with Language

Markdown
```javascript
function greet(name) {
  return `Hello, ${name}!`;
}
console.log(greet("World"));
```

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

print(greet("World"))
```
Preview
function greet(name) {
  return `Hello, ${name}!`;
}
console.log(greet("World"));
def greet(name):
    return f"Hello, {name}!"

print(greet("World"))

Specify the language after the opening backticks for syntax highlighting.

Tips & Best Practices

  • Use inline code for short code snippets within text
  • Use code blocks for longer code examples
  • Specify the language for better syntax highlighting
  • Escape backticks in code using double backticks

Horizontal Rules

Create horizontal dividing lines using three or more hyphens, asterisks, or underscores.

Different Styles

Markdown
---

***

___

- - -

* * *

_ _ _
Preview






All of these create horizontal rules. Choose one style and be consistent.

Tips & Best Practices

  • Use horizontal rules to separate content sections
  • Add blank lines before and after horizontal rules
  • Choose one style and stick with it throughout your document

Images

Embed images using an exclamation mark followed by brackets and parentheses.

Basic Images

Markdown
![Markdown Logo](https://markdown-here.com/img/icon256.png)

![Alt text](image.jpg "Optional title")
Preview

Markdown Logo

Alt text

Use ![alt text](URL) for images. Alt text is important for accessibility.

Reference Images

Markdown
![Markdown Logo][logo]

[logo]: https://markdown-here.com/img/icon256.png "Markdown Logo"
Preview

Markdown Logo

Reference images work like reference links for cleaner text.

Images with Links

Markdown
[![Markdown Logo](https://markdown-here.com/img/icon256.png)](https://markdown-here.com)
Preview

Markdown Logo

Wrap the image syntax in link syntax to make images clickable.

Tips & Best Practices

  • Always include descriptive alt text for accessibility
  • Use relative paths for local images
  • Consider image file sizes for web performance
  • Test image links to ensure they display correctly