Markdown Cheat Sheet: Complete Syntax Reference
The complete Markdown syntax reference. Covers headings, bold, italic, links, images, code blocks, tables, task lists, and GitHub Flavored Markdown extensions.
Try our free Markdown to HTML Converter
Convert Markdown to HTML with live preview. Supports GitHub Flavored Markdown.
What is Markdown?
Markdown is a lightweight markup language created by John Gruber in 2004. It lets you write formatted text using plain-text syntax that is easy to read and write. Markdown files use the .md or .markdown extension and can be converted to HTML, PDF, and many other formats.
Markdown is used everywhere in software development: GitHub READMEs, documentation sites, static site generators (Gatsby, Hugo, Jekyll), note-taking apps (Obsidian, Notion), chat platforms (Slack, Discord), and content management systems. If you write code, you write Markdown.
The most widely adopted variant is GitHub Flavored Markdown (GFM), which extends the original spec with tables, task lists, strikethrough, autolinks, and fenced code blocks. This cheat sheet covers both standard Markdown and GFM extensions. You can test any of the syntax below using our Markdown to HTML Converter, which renders GFM in real time.
Text Formatting
Headings
Use # symbols to create headings. The number of hashes determines the heading level (1-6):
# Heading 1 (renders as <h1>) ## Heading 2 (renders as <h2>) ### Heading 3 (renders as <h3>) #### Heading 4 (renders as <h4>) ##### Heading 5 (renders as <h5>) ###### Heading 6 (renders as <h6>)
Always put a space after the # symbol. #Heading without a space is not valid in most parsers. For best practice, use only one h1 per document and do not skip heading levels.
Bold, Italic, and Strikethrough
Wrap text with special characters to apply inline formatting:
**bold text** renders as bold __also bold__ renders as bold (alternative) *italic text* renders as italic _also italic_ renders as italic (alternative) ***bold and italic*** renders as bold + italic ~~strikethrough~~ renders as strikethrough (GFM)
The asterisk (*) syntax is preferred over underscores (_) because underscores inside words (like file_name_here) can cause unexpected formatting in some parsers. Strikethrough (~~text~~) is a GFM extension and may not render in all Markdown processors.
Paragraphs and Line Breaks
Separate paragraphs with a blank line. For a line break within a paragraph, end a line with two spaces or use <br>:
First paragraph. Second paragraph. Line one with two trailing spaces Line two (same paragraph, forced line break)
Links, Images, and Blockquotes
Links
Create clickable links with square brackets for the display text and parentheses for the URL:
[Link text](https://example.com) [Link with title](https://example.com "Hover title text") [Reference-style link][1] [1]: https://example.com "Reference links are defined elsewhere" Autolink (GFM): https://example.com Email autolink: <user@example.com>
Reference-style links keep your Markdown readable when you have many URLs. GFM also automatically converts bare URLs into clickable links.
Images
Images use the same syntax as links but with an exclamation mark prefix:
  ![Reference image][logo] [logo]: /images/logo.png "Logo"
The alt text is important for accessibility and SEO. If you need to control image size, use HTML: <img src="image.png" width="400" />.
Blockquotes
Prefix lines with > to create blockquotes. Nest them by adding more angle brackets:
> This is a blockquote. > It can span multiple lines. > Nested blockquotes: >> Second level >>> Third level
Blockquotes are commonly used in documentation to highlight important notes, warnings, or quoted text. GitHub also supports colored note blocks using > [!NOTE], > [!WARNING], and > [!TIP].
Lists and Task Lists
Unordered Lists
Use -, *, or + followed by a space. Indent with two or four spaces for nested items:
- First item
- Second item
- Nested item
- Another nested item
- Deep nested item
- Third itemOrdered Lists
Use numbers followed by a period and a space. The actual numbers do not matter -- Markdown auto-numbers them:
1. First item 2. Second item 3. Third item 1. Nested ordered item 2. Another nested item 1. You can use all 1s 1. Markdown still numbers correctly 1. But sequential numbers are more readable
Task Lists (GFM)
Create checkboxes with - [ ] and - [x]. These render as interactive checkboxes on GitHub:
- [x] Write the introduction - [x] Add code examples - [ ] Proofread the document - [ ] Publish to production
Task lists are widely used in GitHub issues and pull request descriptions to track progress. They automatically show a progress bar on GitHub when used in the opening comment of an issue.
Code Blocks and Syntax Highlighting
Inline Code
Wrap text in single backticks for inline code:
Use the `console.log()` function to debug. To escape a backtick inside inline code, use double backticks: ``There is a ` backtick here``
Fenced Code Blocks
Use triple backticks (```) or triple tildes (~~~) for multi-line code blocks. Add the language name after the opening fence for syntax highlighting:
```javascript
function greet(name) {
return `Hello, ${name}!`;
}
```
```python
def greet(name):
return f"Hello, {name}!"
```
```css
.container {
display: flex;
gap: 1rem;
}
```
```bash
npm install && npm run build
```Common language identifiers include: javascript (or js), typescript (or ts), python, bash, json, html, css, sql, yaml, go, rust, and diff. You can preview how your code blocks render using our Markdown to HTML Converter.
Diff Syntax
Use the diff language to highlight added and removed lines. This is useful for showing code changes in documentation. You can also compare text side by side with our Text Diff Tool:
```diff - const old = "removed line"; + const new = "added line"; const unchanged = "context line"; ```
Tables, Horizontal Rules, and Footnotes
Tables (GFM)
Create tables using pipes (|) and hyphens (-). Use colons to align columns:
| Feature | Markdown | HTML | | ------------- | ----------- | ------------------- | | Bold | **text** | <strong>text</strong> | | Italic | *text* | <em>text</em> | | Link | [text](url) | <a href="url">text</a> | Column alignment: | Left-aligned | Center-aligned | Right-aligned | | :----------- | :------------: | ------------: | | Left | Center | Right | | Data | Data | Data |
The pipes on the outer edges are optional, and columns do not need to be perfectly aligned in the source -- they just need to be separated by pipes. The separator row must have at least three hyphens per column.
Horizontal Rules
Create a horizontal divider with three or more hyphens, asterisks, or underscores on a line by themselves:
--- *** ___ All three produce an <hr> element.
Footnotes
Add footnotes with bracket-caret syntax. The footnote content is placed at the bottom of the document:
Here is a sentence with a footnote[^1]. Another reference[^note]. [^1]: This is the footnote content. [^note]: Footnotes can have any label, not just numbers.
Footnotes are supported by GitHub, Jekyll, and many other Markdown processors, but they are not part of the original Markdown specification. The rendered footnotes typically appear as superscript numbers that link to the footnote text at the bottom of the page.
Escaping Special Characters
Use a backslash to display characters that would otherwise be interpreted as Markdown formatting:
\*This is not italic\*
\# This is not a heading
\[This is not a link\](url)
Characters you can escape:
\ ` * _ {} [] () # + - . ! |Frequently Asked Questions
What is the difference between Markdown and HTML?
What is GitHub Flavored Markdown (GFM)?
How do I create a table in Markdown?
Can I use HTML inside Markdown?
Preview Your Markdown Now
Convert Markdown to HTML with live preview. Supports GitHub Flavored Markdown, syntax highlighting, and tables. Free, private, runs in your browser.
Open Markdown to HTML Converter