Reference
Markdown Cheat Sheet
Every piece of CommonMark and GitHub Flavored Markdown syntax, with the source on one side and the rendered result on the other. Hover any snippet to copy it.
Headings
One to six leading hashes set the heading level. Always leave a space after the hashes — CommonMark treats "#Heading" as plain text.
Element
Syntax
Result
Heading level 1
# Heading level 1Heading level 1
Heading level 2
## Heading level 2Heading level 2
Heading level 3
### Heading level 3Heading level 3
Headings 4 to 6
Six is the deepest level. A seventh hash renders as literal text.
#### Heading 4
##### Heading 5
###### Heading 6Heading 4
Heading 5
Heading 6
Setext headings
Alternate underline syntax, limited to levels 1 and 2.
Heading level 1
===
Heading level 2
---Heading level 1
Heading level 2
Emphasis
Asterisks and underscores both work, but asterisks are safer: underscores inside words (snake_case_names) are ignored by most parsers, while asterisks are not.
Element
Syntax
Result
Bold
**bold text**bold text
Italic
Single underscores (_italic_) do the same thing.
*italic text*italic text
Bold and italic
***bold and italic***bold and italic
Strikethrough
GitHub Flavored Markdown extension, not core CommonMark.
~~struck through~~struck through
Escaping
Prefix any Markdown character with a backslash to print it as-is.
Show a literal \*asterisk\* and \_underscore\_.Show a literal *asterisk* and _underscore_.
Lists
Indent by two spaces to nest a level. Ordered lists renumber themselves, so you can write "1." on every line and let the renderer count.
Element
Syntax
Result
Unordered list
A `*` or `+` marker works identically.
- First item
- Second item
- Third item- First item
- Second item
- Third item
Ordered list
1. First item
2. Second item
3. Third item- First item
- Second item
- Third item
Custom start number
7. Seventh item
8. Eighth item- Seventh item
- Eighth item
Nested list
- Parent item
- Child item
- Grandchild item
- Second parent- Parent item
- Child item
- Grandchild item
- Child item
- Second parent
Task list
GFM extension. Supported on GitHub, GitLab, and Obsidian.
- [x] Completed task
- [ ] Outstanding taskParagraph inside a list
1. First item
A second paragraph, indented three spaces to stay inside the item.
2. Second item-
First item
A second paragraph, indented three spaces to stay inside the item.
-
Second item
Links and images
Image syntax is link syntax with a leading exclamation mark. The text in square brackets becomes the alt text, so write something descriptive.
Element
Syntax
Result
Reference link
Keeps long URLs out of the prose. Definitions can sit anywhere in the document.
[Reference-style link][docs]
[docs]: https://markdowneditorai.comImage
Code
Add a language after the opening fence to enable syntax highlighting. If your snippet itself contains three backticks, fence it with four.
Element
Syntax
Result
Inline code
Run `npm install` to begin.Run npm install to begin.
Fenced code block
```
plain preformatted text
```plain preformatted text
Code block with language
```js
const total = items.reduce((sum, n) => sum + n, 0);
```const total = items.reduce((sum, n) => sum + n, 0);
Backticks inside code
Wrap in a longer run of backticks than the content uses.
``Use `backticks` inside code``Use `backticks` inside code
Blockquotes and rules
A blockquote can hold any other block element — lists, headings, even nested quotes. Horizontal rules need three or more of the same character on their own line.
Element
Syntax
Result
Blockquote
> Markdown is a plain text formatting syntax.Markdown is a plain text formatting syntax.
Multi-paragraph quote
> First quoted paragraph.
>
> Second quoted paragraph.First quoted paragraph.
Second quoted paragraph.
Nested blockquote
> Outer quote.
>
> > Inner quote.Outer quote.
Inner quote.
Horizontal rule
`***` and `___` produce the same rule.
---Line break
Two trailing spaces force a break. A trailing backslash works too and is easier to see.
First line ends with two spaces.
Second line.First line ends with two spaces.
Second line.
Tables
A GFM extension. Columns do not need to line up in the source — the delimiter row under the header is what matters, and colons in it set alignment.
Element
Syntax
Result
Basic table
| Syntax | Description |
| --- | --- |
| Header | Title |
| Paragraph | Text || Syntax | Description |
|---|---|
| Header | Title |
| Paragraph | Text |
Column alignment
| Left | Center | Right |
| :--- | :----: | ----: |
| a | b | c |
| longer | cell | values || Left | Center | Right |
|---|---|---|
| a | b | c |
| longer | cell | values |
Escaped pipe
Escape a literal pipe as \| so it does not split the cell.
| Operator | Meaning |
| --- | --- |
| `\|\|` | Logical OR || Operator | Meaning |
|---|---|
|| |
Logical OR |
Extended syntax
Support for these varies by platform. GitHub, GitLab, and most static site generators handle them; plain CommonMark parsers may not.
Element
Syntax
Result
Footnote
Markdown was created in 2004.[^1]
[^1]: By John Gruber and Aaron Swartz.Definition list
Not supported everywhere — GitHub renders this as plain text.
Markdown
: A lightweight markup language.Markdown : A lightweight markup language.
Inline HTML
Escaped by default for safety. The editor on this site has an "Allow raw HTML" toggle that renders it (sanitized) instead.
Text with <kbd>Ctrl</kbd> + <kbd>C</kbd> keys.Text with Ctrl + C keys — rendered as real HTML where raw HTML is allowed.
A practical Markdown cheat sheet
Markdown is a lightweight way to add structure and emphasis to plain text. Instead of clicking a formatting toolbar, you type small markers that a renderer turns into headings, links, lists, and other readable content. This Markdown cheat sheet puts the most useful syntax in one place, with copyable source and a live rendered example beside it. It is useful when you are writing README files, project documentation, blog posts, notes, issue descriptions, or messages in a tool that supports Markdown.
Start with headings by placing one to six hash characters before a title: # Headingcreates the largest heading, while ## Section creates a smaller level-two heading. Use a blank line to separate paragraphs. Wrap words in single asterisks for italics and double asterisks for bold. For a reusable Markdown link, write[description](https://example.com); the description becomes the clickable text. Images use a similar pattern with an exclamation mark, although support can vary between platforms.
Lists make documents easier to scan. Begin an unordered list item with -,*, or +, and begin an ordered item with a number followed by a period. Indent nested items consistently so the renderer can understand the hierarchy. Task lists are a GitHub Flavored Markdown extension: - [ ] Todo creates an unchecked box and - [x] Done creates a checked one. Blockquotes begin with>, making them useful for quotations, callouts, or copied issue context.
Use backticks for code. A pair of single backticks creates inline code such asnpm run build. Three backticks create a fenced code block, and adding a language name after the opening fence enables syntax highlighting in renderers that support it:```js. Horizontal rules use three or more hyphens on their own line. To add a line break without a new paragraph, end the line with two spaces or a backslash. These small details are why a rendered preview is valuable: it shows whether invisible spaces and delimiters are doing what you intended.
CommonMark defines the portable core of Markdown, including headings, emphasis, links, lists, code, and blockquotes. GitHub Flavored Markdown, often shortened to GFM, builds on that core with tables, task lists, strikethrough, autolinks, and fenced code conveniences. A table uses pipes and a separator row, for example| Name | Status | followed by | --- | --- |. Not every application supports every extension, so check the destination platform when formatting needs to survive outside GitHub.
When Markdown does not render as expected, inspect the characters around the syntax first. A missing blank line can change a paragraph into a list, an unclosed backtick can consume the rest of a sentence, and a space inside emphasis markers can prevent bold or italics. Escape a special character with a backslash when you need it to appear literally, such as \*not italic\*. Be careful with raw HTML too: some platforms allow it, while secure applications escape or sanitize it. The safest workflow is to preview untrusted content before publishing and to use the destination renderer's documented feature set.
This reference is designed for quick lookup rather than memorisation. Find a syntax category in the table, copy the exact marker, and compare the result in the preview. For longer documents, open theMarkdown editor to write with live preview, word counts, and a downloadable source file. You can also build aligned GFM tables with theMarkdown table generator, convert a document to HTML with the Markdown to HTML converter, or export a polished document as a PDF. Because the tools run in your browser, drafts stay local while you test formatting and prepare documentation.
Frequently asked questions
What is the difference between CommonMark and GitHub Flavored Markdown?
CommonMark is the strict specification that defines the core syntax — headings, emphasis, lists, links, code, and blockquotes. GitHub Flavored Markdown (GFM) is a superset that adds tables, task lists, strikethrough, and automatic linking. Everything marked as an extension on this page is GFM, not core CommonMark.
Why is my bold or italic text not rendering?
The most common cause is a space between the marker and the text: "** bold **" does not work, "**bold**" does. The second cause is using underscores inside a word, such as file_name_here, which most parsers deliberately ignore so that code identifiers survive. Use asterisks when in doubt.
How do I add a line break without starting a new paragraph?
End the line with two spaces, or with a backslash, then press Enter. A blank line instead starts a new paragraph. Trailing spaces are invisible in most editors, so the backslash is easier to maintain.
Can I use HTML inside Markdown?
Most renderers allow inline HTML, which is how people add things like keyboard tags or coloured text. Renderers that accept untrusted input escape it by default because it opens a cross-site scripting hole. The editor on this site escapes raw HTML unless you turn on its "Allow raw HTML" toggle, which renders it through a sanitizer instead of trusting it outright.
Does this syntax work in Discord?
Only partly. Discord uses its own dialect with no tables, images, footnotes, or horizontal rules, but it adds underline, spoilers, and subtext. See the Discord Markdown cheat sheet for the differences.
Put it into practice in the Markdown editor, build pipe tables in the table generator, turn a document into HTML or bring existing markup back with the HTML to Markdown converter, or check what Discord supports in the Discord Markdown cheat sheet.