πŸ“ Markdown Cheat Sheet

The complete markdown syntax guide with examples. Master markdown formatting from basic text to advanced tables, code blocks, and more.

← Back to Markdown Viewer

πŸ“– What is Markdown?

Markdown is a lightweight markup language created by John Gruber in 2004. It's designed to be easy to read and write, converting plain text into formatted HTML. Today, markdown syntax is used everywhereβ€”from GitHub READMEs to documentation, blogs, forums, and note-taking apps.

The beauty of markdown formatting is its simplicity. Unlike HTML, which requires opening and closing tags, markdown uses intuitive symbols. For example, wrapping text in asterisks makes it bold (**bold**), and using hash symbols creates headings (# Heading).

Why Learn Markdown?

πŸ’‘ Tip: This markdown cheat sheet covers everything from basic formatting to advanced tables. Bookmark it for quick reference!

πŸ“‘ Headings

Create headings by starting a line with hash symbols (#). The number of hashes determines the heading level. Markdown supports six heading levels, from # H1 to ###### H6.

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Alternative Heading Syntax

For H1 and H2, you can also use underlines:

Heading 1
=========

Heading 2
---------
πŸ’‘ Best Practice: Use only one H1 per page (your main title). Use H2-H6 for subsections. This improves SEO and accessibility.

✨ Text Formatting

Markdown bold, italic, and other text formatting is easy to apply. Here's the complete guide to markdown text formatting:

Format Markdown Syntax Result
Bold **bold text** or __bold__ bold text
Italic *italic text* or _italic_ italic text
Bold & Italic ***bold and italic*** bold and italic
Strikethrough ~~strikethrough~~ strikethrough
Inline Code `code` code

How to Bold in Markdown

To make text bold in markdown, wrap it with double asterisks or double underscores:

This is **bold text** in markdown.
This is also __bold text__ in markdown.

How to Italicize in Markdown

For italic markdown text, use single asterisks or single underscores:

This is *italic text* in markdown.
This is also _italic text_ in markdown.

Markdown Strikethrough

Strikethrough markdown uses double tildes. This is great for showing deleted or outdated content:

~~This text is crossed out~~

πŸ–ΌοΈ Images

Markdown images work similarly to links, but with an exclamation mark prefix. The syntax for markdown with images is: ![alt text](image-url).

Image Syntax

![Alt text](image.jpg)

![Logo](logo.png "Optional title")

![Remote image](https://example.com/image.jpg)

Linked Images

To make an image clickable, wrap it in link syntax:

[![Alt text](image.jpg)](https://example.com)
πŸ’‘ Accessibility: Always include descriptive alt text for markdown images. Screen readers rely on this text.

πŸ“‹ Lists

Markdown lists come in two flavors: ordered (numbered) and unordered (bulleted). Lists in markdown are essential for organizing content.

Unordered Lists

Create list markdown items with dashes, asterisks, or plus signs:

- Item one
- Item two
- Item three

* Also works
+ This too
  • Item one
  • Item two
  • Item three

Ordered Lists

For numbered markdown lists, use numbers followed by periods:

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

Nested Lists

Indent with spaces or tabs for nested lists markdown:

- Parent item
  - Child item
    - Grandchild item
- Another parent

πŸ’¬ Blockquotes

Create blockquotes with the greater-than symbol (>):

> This is a blockquote.
>
> It can span multiple paragraphs.
This is a blockquote.

It can span multiple paragraphs.

Nested Blockquotes

> Level 1 quote
>> Level 2 nested quote
>>> Level 3 deeply nested

πŸ’» Code & Code Blocks

Markdown code blocks are essential for technical documentation. There are two types: inline code and fenced code blocks markdown.

Inline Code

Wrap code with single backticks:

Use the `console.log()` function to debug.

Fenced Code Blocks

For multi-line markdown code block syntax, use triple backticks with an optional language:

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

Supported Languages

Common language identifiers for syntax highlighting in code blocks markdown:

javascript, js python, py html css
java csharp, c# cpp, c++ go
rust ruby php sql
bash, shell json yaml markdown, md

πŸ“Š Markdown Tables

Markdown tables use pipes and dashes to create structured data. Table markdown is one of the most useful features for organizing information. Learn how to create tables in markdown below.

Basic Table Syntax

A table in markdown requires headers, a separator row, and data rows:

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6

Table Alignment

Control column alignment in tables markdown using colons:

| Left | Center | Right |
|:---------|:--------:|---------:|
| Left | Center | Right |
πŸ’‘ Pro Tip: Use our Markdown Table Generator to create markdown for tables visually!

βž– Horizontal Rules

Create horizontal dividers with three or more dashes, asterisks, or underscores:

---

***

___

All three produce the same horizontal line.

β˜‘οΈ Task Lists (Checkboxes)

Markdown checkboxes create interactive task lists. This is a GitHub Flavored Markdown (GFM) extension for markdown checkbox items.

- [x] Completed task
- [x] Another done item
- [ ] Incomplete task
- [ ] Todo item

β˜‘οΈ Completed task

β˜‘οΈ Another done item

☐ Incomplete task

☐ Todo item

Use - [x] for checked checkboxes in markdown and - [ ] for unchecked items.

↡ Line Breaks

Understanding markdown line break behavior is important. By default, single line breaks are ignored. Here's how to handle line break in markdown:

Methods for Line Breaks

Markdown New Line Example

Line one with two spaces at the end  
Line two appears below

Line three with backslash\
Line four appears below

πŸ”’ Escaping Characters

To display literal markdown characters, escape them with a backslash (\):

\*Not italic\*
\# Not a heading
\[Not a link\](url)

Characters That Can Be Escaped

\ ` * _ { } [ ] ( ) # + - . ! |

πŸš€ Extended Syntax (GFM)

GitHub Flavored Markdown (GFM) and other implementations add these extended features to standard markdown syntax:

Feature Syntax Description
Footnotes Text[^1] ... [^1]: Note Reference notes at bottom
Definition Lists Term
: Definition
Term/definition pairs
Highlight ==highlighted== Highlighted text
Subscript H~2~O Hβ‚‚O
Superscript X^2^ XΒ²
Emoji :smile: πŸ˜„ (on supported platforms)
Auto-links https://example.com Automatic URL linking

Markdown Comments

Comment markdown content that won't render using HTML syntax:

<!-- This is a markdown comment -->
<!-- It won't appear in the output -->

πŸ“– Quick Reference

Complete markdown cheat sheet quick reference table:

Element Syntax
Heading # H1 through ###### H6
Bold **text**
Italic *text*
Strikethrough ~~text~~
Link [text](url)
Image ![alt](url)
Code `code`
Code Block ```lang ... ```
Blockquote > quote
Unordered List - item
Ordered List 1. item
Task List - [x] done
Table | col | col |
Horizontal Rule ---
Line Break Two spaces + Enter

Ready to Practice?

Try out everything from this markdown cheat sheet in our free online editor with live preview.

Open Markdown Viewer β†’