Markdown Cheat Sheet: Syntax & Examples
A practical Markdown cheat sheet — headings, bold, lists, links, images, code blocks, tables and more, with copy-ready syntax for READMEs, GitHub and docs.
Markdown is a lightweight way to format plain text using simple punctuation marks instead of buttons or menus. It powers README files, GitHub issues and comments, chat apps, static-site content, and countless documentation tools. This cheat sheet collects the syntax you’ll actually use, grouped by task, with copy-ready examples. Each table shows the literal characters you type — note that a single line break is usually ignored, so leave a blank line between paragraphs.
Headings
Headings run from level 1 (largest) to level 6 (smallest). Put a space after the # characters, and many parsers prefer a blank line before and after a heading.
| Element | Markdown | Result |
|---|---|---|
| Heading 1 | # Heading 1 | Largest, top-level title |
| Heading 2 | ## Heading 2 | Section heading |
| Heading 3 | ### Heading 3 | Sub-section heading |
| Heading 4 | #### Heading 4 | Smaller heading |
| Heading 5 | ##### Heading 5 | Smaller still |
| Heading 6 | ###### Heading 6 | Smallest heading |
Bold, italic & strikethrough
You can mark text inline. Asterisks and underscores both work for bold and italic; pick one and stay consistent.
| Element | Markdown | Result |
|---|---|---|
| Italic | *italic* or _italic_ | italic |
| Bold | **bold** or __bold__ | bold |
| Bold + italic | ***bold italic*** | bold italic |
| Strikethrough | ~~struck out~~ |
Lists (unordered, ordered, nested)
Use -, *, or + for bullet points, and numbers followed by a period for ordered lists. Indent with spaces (two or four) to nest items.
| Element | Markdown |
|---|---|
| Unordered item | - First item |
| Unordered (alt markers) | * Item or + Item |
| Ordered item | 1. First item |
| Nested item | - Indented sub-item |
A nested example, written out:
- Fruit
- Apple
- Orange
1. Step one
2. Step two
1. Sub-step
Note: most renderers auto-number ordered lists, so you can write 1. on every line and it will still count up correctly.
Links & images
Links wrap the text in square brackets and the URL in parentheses. Images use the same pattern with a leading !, where the bracketed text becomes the alt text.
| Element | Markdown |
|---|---|
| Inline link | [link text](https://example.com) |
| Link with title | [link text](https://example.com "Hover title") |
| Reference link | [link text][ref] then [ref]: https://example.com |
| Bare URL (autolink) | <https://example.com> |
| Image |  |
| Image with title |  |
| Linked image | [](https://example.com) |
Inline code & code blocks
Wrap inline code in single backticks. For multi-line blocks, use triple backticks (a “fence”) or indent every line by four spaces. Adding a language name after the opening fence enables syntax highlighting on most platforms.
| Element | Markdown |
|---|---|
| Inline code | `inline code` |
| Fenced code block | ```code``` (on its own lines) |
| Fenced with language | ```js … ``` |
| Indented code block | four leading spaces before each line |
A fenced block with a language fence looks like this:
```js
function greet(name) {
return `Hello, ${name}!`;
}
```
Tip: to show a literal backtick inside inline code, wrap it in a longer run of backticks, like code .
Blockquotes
Start a line with > to quote it. Add another > to nest quotes, and you can place other elements (lists, headings) inside a quote.
| Element | Markdown | Result |
|---|---|---|
| Blockquote | > Quoted text | > Quoted text |
| Nested blockquote | >> Nested quote | A quote inside a quote |
| Multi-paragraph quote | > Para one then > then > Para two | Two quoted paragraphs |
Tables
Tables use pipes | to separate columns and a row of dashes --- to split the header from the body. Colons in the divider row set column alignment. The pipes don’t need to line up perfectly — the example below is spaced only for readability.
| Element | Markdown |
|---|---|
| Header row | ` |
| Divider row | ` |
| Data row | ` |
| Left align | ` |
| Center align | ` |
| Right align | ` |
A complete table written out:
| Name | Role |
| :---- | ------: |
| Ada | Author |
| Linus | Builder |
Horizontal rules
A horizontal rule draws a divider line across the page. Use three or more of the same character on a line by itself, with a blank line above and below.
| Element | Markdown | Result |
|---|---|---|
| Rule (dashes) | --- | A horizontal divider |
| Rule (asterisks) | *** | A horizontal divider |
| Rule (underscores) | ___ | A horizontal divider |
Task lists
Task lists (checkboxes) are a GitHub Flavored Markdown feature, handy for to-do items in issues and pull requests. They’re an unordered list with [ ] or [x] after the marker.
| Element | Markdown | Result |
|---|---|---|
| Unchecked task | - [ ] To do | An empty checkbox |
| Checked task | - [x] Done | A ticked checkbox |
Tips & flavors
- Flavors differ. Markdown has several dialects. The original is CommonMark; GitHub Flavored Markdown (GFM) extends it with tables, task lists, strikethrough, and automatic linking of URLs. Tools like GitLab, Reddit, Discord, and various static-site generators each support slightly different subsets.
- Rendering varies by platform. A feature that works on GitHub may not work in a basic editor, and vice versa — when in doubt, preview your text where it will actually be published.
- Raw HTML often works. Many parsers let you drop in HTML (for example
<br>for a hard line break or<sub>/<sup>) when Markdown alone can’t express what you need, though some platforms strip it for safety. - Escape special characters with a backslash — for example
\*not italic\*renders the asterisks literally instead of turning the text italic.