Markdown Cheat Sheet — Syntax With Live Preview
Every Markdown element with source and rendered preview, extended syntax (tables, task lists, footnotes, math, Mermaid, alerts), a 9-platform compatibility table and a live playground.
Last verified: 2026-10-18 against CommonMark 0.31.2, the GFM spec, and the GitHub, GitLab, Obsidian, Slack and Jira formatting docs. Sources: CommonMark spec 0.31.2, GitHub Flavored Markdown spec, GitHub writing and formatting docs, GitLab Flavored Markdown, Obsidian help, Slack message formatting, Jira text formatting notation.
Basic syntax (works everywhere CommonMark does)
These elements are in the CommonMark specification, so they behave the same in GitHub, GitLab, VS Code, Obsidian, static-site generators and most documentation tools.
One to six # followed by a space. Use one # heading per document and do not skip levels; screen readers and tables of contents rely on the order.
# Heading 1 ## Heading 2 ### Heading 3 #### Heading 4
The older "setext" style; only levels 1 and 2. A line of --- under a paragraph makes it a heading, which surprises people expecting a horizontal rule: leave a blank line before ---.
Heading 1 ========= Heading 2 ---------
A blank line separates paragraphs. A single line break inside a paragraph is joined into one line (except where noted under line breaks).
First paragraph, which can wrap across several source lines. Second paragraph after a blank line.
First paragraph, which can wrap across several source lines.
Second paragraph after a blank line.
For a line break without a new paragraph, end the line with two spaces or a backslash. GitHub comments, Obsidian (by default), Slack and Discord treat every newline as a break instead.
Two trailing spaces make a break. A trailing backslash\ works too.<br>So does an HTML br.
Two trailing spaces
make a break.
A trailing backslash
works too.
So does an HTML br.
Asterisks work inside words; underscores do not (snake_case_names stay literal), which is why most style guides prefer *.
**bold** or __bold__ *italic* or _italic_ ***bold italic*** in**side**word works with *, not with _
bold or bold
italic or italic
bold italic
insideword works with *, not with _
Start each line with >. Quotes can contain any other Markdown, including lists and code.
> Quoted text. > Still quoted. > > > Nested quote.
Quoted text. Still quoted.
Nested quote.
-, * or + all work; do not mix them in one list (a different marker starts a new list).
- Item - Item - Nested (indent 2 spaces) - Item
- Item
- Item
- Nested (indent 2 spaces)
- Item
The first number sets the start; later numbers are ignored, so "1." on every line renumbers itself when you reorder items.
1. First 1. Second 1. Third 3. Starts at three 4. Four
First
Second
Third
Starts at three
Four
Indent extra content to line up with the first character of the item text (3 spaces after "1. ").
1. Install: ```sh npm install marked ``` 2. Indent continuation lines to the item text.
Install:
npm install markedIndent continuation lines to the item text.
Markdown inside backticks is not interpreted.
Run `npm test` now. Use ``double `backticks` `` when the code contains one.
Run npm test now.
Use double `backticks` when the code contains one.
Three backticks (or ~~~) on their own lines. The word after the fence names the language for syntax highlighting on GitHub, GitLab, Obsidian and Discord.
```js const answer = 42; console.log(answer); ```
const answer = 42;
console.log(answer);
The original syntax. Fences are clearer and allow a language; indented code is the only form old Reddit understands.
Paragraph.
four spaces of indent
make a code blockParagraph.
four spaces of indent
make a code block
Three or more -, * or _ on a line of their own, with a blank line above.
Above --- Below (also *** or ___)
Above
Below (also *** or ___)
The angle-bracket form is CommonMark's autolink. Spaces in a URL must be written %20 or the URL wrapped in <…>.
[Link text](https://freetoolsforweb.com) [With a title](https://freetoolsforweb.com "Hover text") [Relative link](/tools/regex-cheat-sheet) <https://example.com>
Keeps long URLs out of the text. Definitions can sit anywhere in the document and are not displayed.
On GitHub and GitLab every heading gets an automatic id: lower-cased, spaces to hyphens, punctuation removed ("## Install & Run" becomes #install--run). Obsidian uses [[#Heading]] instead.
[Jump to tables](#md-tables)
Like a link with ! in front. The text in [ ] is the alt text: describe the image for people who cannot see it. Markdown has no size syntax; use HTML <img width="200"> where HTML is allowed.
A backslash makes any ASCII punctuation literal: \ ` * _ { } [ ] ( ) # + - . ! |
\*not italic\* \# not a heading 1\. not a list
*not italic* # not a heading 1. not a list
Allowed by CommonMark. GitHub and GitLab keep a safe subset (no script, style or event handlers); Slack, Discord, Reddit and Notion show it as text.
Press <kbd>Ctrl</kbd> + <kbd>C</kbd>, H<sub>2</sub>O, x<sup>2</sup>.
Press Ctrl + C, H2O, x2.
An HTML comment is kept in the source but not displayed wherever HTML is allowed.
Visible. <!-- Not rendered: notes for editors --> Also visible.
Visible.
Also visible.
Extended syntax (GFM and friends)
Not part of CommonMark. Support varies, so check the compatibility table before relying on these outside GitHub.
The second line is required; colons set alignment. Columns need not line up in the source. Escape a literal pipe as \|. No merged cells or multi-line cells (use <br> inside a cell on GitHub).
Where: GFM, GitLab, Obsidian, Reddit; Notion on paste
| Left | Centre | Right | | :--- | :----: | ----: | | a | b | 1 | | `c` | **d** | 22 |
| Left | Centre | Right |
|---|---|---|
| a | b | 1 |
c |
d | 22 |
On GitHub and GitLab the boxes are clickable in issues and pull requests and update the source.
Where: GFM, GitLab, Obsidian; Notion via the [] shortcut
- [x] Write the draft - [ ] Review - [ ] Publish
- Write the draft
- Review
- Publish
Two tildes everywhere; GitHub also accepts one. Slack uses ~single~ tildes, Jira -hyphens-.
Where: GFM, GitLab, Obsidian, Discord, Reddit, Notion
~~no longer true~~
no longer true
GFM turns bare URLs and www. addresses into links. In plain CommonMark they stay text unless wrapped in <…>.
Where: GFM, GitLab, Obsidian, Slack, Discord, Reddit
Visit https://freetoolsforweb.com or www.example.com.
Visit https://freetoolsforweb.com or www.example.com.
The definition can go anywhere; footnotes are numbered in order of reference and listed at the end. Obsidian also has inline footnotes: ^[like this].
Where: GFM, GitLab, Obsidian (not CommonMark)
Sets the anchor yourself. Supported by Pandoc, PHP Markdown Extra, Hugo, Jekyll (kramdown), MkDocs and Docusaurus; GitHub and GitLab ignore it and show the braces, using automatic ids instead.
Where: Pandoc, Hugo, Jekyll, MkDocs, Docusaurus; not GitHub or GitLab
### Install {#setup}Rendered by Pandoc, Hugo or kramdown with id="setup", so /page#setup links here.
Colon-wrapped names. Typing a colon in GitHub, Slack, Discord or Notion opens an emoji picker. Pasting the emoji itself works everywhere.
Where: GitHub, GitLab, Slack, Discord; not Obsidian (without a plugin) or CommonMark
Ship it :rocket: :+1: :tada:
Ship it 🚀 👍 🎉
TeX between $ signs inline, $$ for a display block. GitHub also accepts $`…`$ and a ```math block; GitLab supports the same forms. Notion uses $$…$$ for inline equations.
Where: GitHub, GitLab, Obsidian, Notion (own syntax)
Inline: $E = mc^2$
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$Inline: E = mc2
∑i=1n i = n(n+1) ⁄ 2
A code block with the language mermaid becomes a diagram: flowcharts, sequence, class, state, Gantt and ER diagrams.
Where: GitHub, GitLab, Obsidian, Notion (Mermaid code block)
```mermaid
flowchart LR
A[Write] --> B{Review}
B -->|ok| C[Publish]
B -->|changes| A
```(changes loop back to Write)
GitHub has five types: NOTE, TIP, IMPORTANT, WARNING, CAUTION. GitLab (17.10+) accepts the same syntax. Obsidian has many more types, custom titles (> [!tip] Title) and folding (> [!faq]-).
Where: GitHub, GitLab 17.10+, Obsidian; a plain quote elsewhere
> [!NOTE] > Useful information. > [!WARNING] > Critical content that needs attention.
Useful information.
Critical content that needs attention.
HTML, but widely supported. Leave blank lines around the Markdown inside, or it is not parsed.
Where: GitHub, GitLab, Obsidian, most static-site generators
<details> <summary>Click to expand</summary> Hidden **Markdown** content. </details>
Click to expand
Hidden Markdown content.
Obsidian and some editors (Typora, iA Writer); GitHub shows the equals signs. Use <mark> where HTML is allowed.
Where: Obsidian, Typora; not GitHub
This is ==highlighted== text.
This is highlighted text.
Compatibility: CommonMark, GitHub, GitLab, Obsidian, Notion, Slack, Discord, Reddit, Jira
✓ works as written · ~ works with different syntax or only partly (see note) · ✗ not available. Notion and Slack's composer convert Markdown shortcuts as you type rather than rendering a Markdown file; Jira Data Center fields use wiki markup, while Jira Cloud's editor accepts Markdown-style shortcuts while typing.
| Feature | CommonMark | GitHub (GFM) | GitLab | Obsidian | Notion | Slack (mrkdwn) | Discord | Jira wiki | |
|---|---|---|---|---|---|---|---|---|---|
| Headings # | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax # , ## , ### shortcuts while typing | ✗ No Use *bold* lines | ~ Partly / different syntax #, ## and ### only | ✓ Yes | ~ Partly / different syntax h1. to h6. |
| Bold / italic | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax *bold* and _italic_ (single characters) | ✓ Yes Also __underline__ | ✓ Yes | ~ Partly / different syntax *bold* and _italic_ |
| Strikethrough | ✗ No | ✓ Yes ~~ or ~ | ✓ Yes | ✓ Yes | ✓ Yes ~text~ or ~~text~~ | ~ Partly / different syntax ~text~ | ✓ Yes | ✓ Yes | ~ Partly / different syntax -text- |
| Inline code | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax {{monospace}} |
| Fenced code block | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax ``` works, no language highlighting | ✓ Yes | ~ Partly / different syntax New Reddit and apps; old.reddit needs 4-space indent | ~ Partly / different syntax {code:java} … {code} |
| Syntax highlighting | ~ Partly / different syntax Language is passed to the renderer; highlighting is up to it | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes Pick the language on the block | ✗ No | ✓ Yes | ✗ No | ✓ Yes {code:language} |
| Blockquote > | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax Type " then space; > then space makes a toggle | ✓ Yes | ✓ Yes >>> quotes the rest of the message | ✓ Yes | ~ Partly / different syntax bq. or {quote} … {quote} |
| Lists | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax Composer turns "- " into a list; no list syntax in API mrkdwn | ✓ Yes | ✓ Yes | ~ Partly / different syntax * bullets, # numbers, ** to nest |
| Links [text](url) | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes Also [[wikilinks]] | ~ Partly / different syntax Converted when pasted | ~ Partly / different syntax <https://url|text> in API messages | ✓ Yes Masked links | ✓ Yes | ~ Partly / different syntax [text|https://url] |
| Bare URLs auto-link | ~ Partly / different syntax Only <https://…> | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes |
| Images  | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes Also ![[file.png]] | ~ Partly / different syntax On import or paste | ✗ No Upload instead | ✗ No Attach or paste a link | ✗ No Upload in the editor | ~ Partly / different syntax !image.png! |
| Tables | ✗ No | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax Pasted Markdown tables become simple tables | ✗ No | ✗ No | ✓ Yes | ~ Partly / different syntax ||head|| and |cell| |
| Task lists | ✗ No | ✓ Yes | ✓ Yes Also [~] for inapplicable | ✓ Yes | ~ Partly / different syntax [] then space makes a to-do | ✗ No | ✗ No | ✗ No | ✗ No |
| Footnotes | ✗ No | ✓ Yes | ✓ Yes | ✓ Yes Also inline ^[note] | ✗ No | ✗ No | ✗ No | ✗ No | ✗ No |
| Heading anchors | ✗ No | ~ Partly / different syntax Automatic only, no {#id} | ~ Partly / different syntax Automatic only | ~ Partly / different syntax Link with [[#Heading]] | ~ Partly / different syntax Copy a block link instead | ✗ No | ✗ No | ✗ No | ~ Partly / different syntax {anchor:name} |
| Emoji shortcodes :smile: | ✗ No | ✓ Yes | ✓ Yes | ✗ No Plugin needed | ~ Partly / different syntax Typing : opens a picker | ✓ Yes | ✓ Yes | ✗ No | ~ Partly / different syntax Text smileys such as :) :D (y) |
| Math $…$ | ✗ No | ✓ Yes | ✓ Yes | ✓ Yes | ~ Partly / different syntax $$…$$ inline, /equation for blocks | ✗ No | ✗ No | ✗ No | ✗ No |
| Mermaid diagrams | ✗ No | ✓ Yes | ✓ Yes | ✓ Yes | ✓ Yes Code block set to Mermaid | ✗ No | ✗ No | ✗ No | ✗ No Needs a Marketplace app |
| Callouts > [!NOTE] | ✗ No | ✓ Yes 5 types | ✓ Yes 17.10+ | ✓ Yes Many types, foldable | ✗ No Use /callout | ✗ No | ✗ No | ✗ No | ~ Partly / different syntax {panel} … {panel} |
| Raw HTML | ✓ Yes | ~ Partly / different syntax Safe subset; no script, style or iframes | ~ Partly / different syntax Safe subset | ~ Partly / different syntax Sanitised subset | ✗ No | ✗ No | ✗ No | ✗ No | ✗ No |
| Single newline = line break | ✗ No Two trailing spaces or \ | ~ Partly / different syntax In comments yes, in .md files no | ~ Partly / different syntax In comments yes, in files no | ~ Partly / different syntax Yes unless "Strict line breaks" is on | ✓ Yes Shift+Enter in a block | ✓ Yes | ✓ Yes | ✗ No Two trailing spaces | ~ Partly / different syntax Newline yes; \\ forces one |
Same thing, different syntax
The pairs that trip people up when pasting between tools: Slack and Jira use single * for bold, and Slack links put the URL first.
| Element | Markdown / GFM | Slack mrkdwn | Discord | Jira wiki | |
|---|---|---|---|---|---|
| Bold | **bold** | *bold* | **bold** | **bold** | *bold* |
| Italic | *italic* | _italic_ | *italic* | *italic* | _italic_ |
| Strikethrough | ~~text~~ | ~text~ | ~~text~~ | ~~text~~ | -text- |
| Underline | (none; <ins> in HTML) | (none) | __text__ | (none) | +text+ |
| Inline code | `code` | `code` | `code` | `code` | {{code}} |
| Code block | ```js … ``` | ``` … ``` | ```js … ``` | 4-space indent | {code:js} … {code} |
| Link | [text](https://url) | <https://url|text> | [text](https://url) | [text](https://url) | [text|https://url] |
| Heading | ## Title | (none) | ## Title | ## Title | h2. Title |
| Quote | > text | > text | > text | > text | bq. text |
| Bullet list | - item | • item (typed) | - item | - item | * item |
| Numbered list | 1. item | 1. item (typed) | 1. item | 1. item | # item |
| Spoiler | <details> (HTML) | (none) | ||text|| | >!text!< | (none) |
Markdown playground
Previews and the playground render in your browser; nothing you type is sent anywhere. Browse all free tools.
Found a problem, or something that could be better? We read every message and we fix things quickly.
This Markdown cheat sheet shows every element twice: the Markdown you type and what it renders as, side by side, so you can copy the source and know what you will get. The basics (headings, emphasis, lists, links, images, code) come first, then the extended syntax most people actually need on GitHub: tables, task lists, strikethrough, footnotes, alerts, math and Mermaid diagrams.
Markdown is not one language. CommonMark defines the core; GitHub and GitLab add their own extensions; Obsidian and Notion add more; Slack, Discord, Reddit and Jira each use something Markdown-like with different rules, such as *single asterisks* for bold in Slack and Jira. The compatibility table shows what works where, and the translation table gives the exact syntax for each chat or ticketing tool. Previews are rendered with the open-source marked library (CommonMark plus GFM); features it does not implement show how GitHub or Obsidian displays them. A small playground at the end renders anything you type, in your browser.
How to use
- Search for an element (table, checkbox, footnote, line break) or jump to a section from the chips at the top.
- Copy the Markdown from the left of any card; the right shows how it renders.
- Check the compatibility table before using an extension outside GitHub, and the translation table when pasting into Slack, Discord, Reddit or Jira.
- Paste your own text into the playground to preview it, then copy the HTML or download a .md file.
Frequently asked questions
How do I make a table in Markdown?
Write the header row with pipes, then a separator row of dashes, then the data rows: | Name | Age |, then | --- | --- |, then | Ana | 31 |. Colons in the separator set alignment (:--- left, :---: centre, ---: right). Tables are a GitHub Flavored Markdown extension, supported by GitHub, GitLab, Obsidian, Reddit and most editors, but not by plain CommonMark, Slack or Discord.
How do I add a line break without starting a new paragraph?
End the line with two spaces or a backslash, or use <br> where HTML is allowed. A single newline is otherwise joined into the same paragraph in CommonMark and GitHub .md files. GitHub comments, Obsidian (by default), Slack and Discord treat every newline as a line break, which is why the same text can look different in a README and in an issue.
What is the difference between CommonMark and GitHub Flavored Markdown?
CommonMark is a precise specification of the original Markdown syntax. GitHub Flavored Markdown (GFM) is a strict superset that adds tables, task lists, strikethrough, extended autolinks and a filter for unsafe HTML. On github.com, footnotes, alerts, math, Mermaid diagrams and emoji shortcodes are added on top of GFM by GitHub's own processing.
How do I write a checkbox or to-do list in Markdown?
Use a list item that starts with [ ] for an open task or [x] for a done one: - [ ] Review, - [x] Write draft. GitHub and GitLab render clickable checkboxes in issues and pull requests, Obsidian toggles them in reading view, and GitLab also accepts [~] for an inapplicable task.
Does Slack support Markdown?
Partly, with its own rules called mrkdwn: *bold* with single asterisks, _italic_, ~strikethrough~ with single tildes, `code` and ``` code blocks, > quotes, and links written as <https://url|text> in messages sent through the API. There are no headings, tables or images. Slack's message composer also converts some formatting as you type, and Block Kit has a separate markdown block that accepts standard Markdown.
How do I add a footnote in Markdown?
Put [^1] where the reference goes and define it on its own line anywhere in the document: [^1]: The source. GitHub, GitLab and Obsidian number footnotes in order of use and list them at the bottom with back-links. CommonMark, Slack, Discord, Reddit and Notion have no footnotes.
Writing Markdown that renders the same everywhere
• Leave a blank line before and after headings, lists, code blocks, tables and HTML blocks. Many "why didn't it render" problems are a missing blank line.
• Use fenced code blocks with a language (```python) rather than indentation; they are clearer and get highlighting.
• Use * for emphasis rather than _, because underscores inside words (snake_case_names) are left alone by CommonMark but treated differently by older renderers.
• Pick one bullet character per list; switching from - to * starts a new list.
• Indent nested list content to line up with the text of the parent item, not a fixed two or four spaces.
• Write alt text for every image. It is shown when the image fails to load and read aloud by screen readers.
README essentials on GitHub
GitHub renders README.md at the root, in docs/ or in .github/. Headings automatically get anchors, and GitHub builds a table of contents from them (the outline button on the file view), so a clear heading structure is the table of contents. Relative links and images (./docs/setup.md, ./images/demo.png) work on github.com and keep working in forks and on other branches, unlike absolute URLs.
Alerts (> [!NOTE], > [!WARNING]) stand out for installation caveats, Mermaid code blocks draw architecture diagrams that stay editable, and <details> collapses long sections such as full configuration references. Keep the first screen to what the project is, how to install it and a minimal example; everything else can sit below.
Related free tools
- ChatGPT to Word — Paste an answer from ChatGPT, Claude or Gemini and copy it into Word, Google Docs or email with real headings, tables and lists instead of ** and #.
- Word Counter — Count words, characters, sentences and reading time, and check X, LinkedIn, Instagram, YouTube, SEO and SMS limits as you type.
- Git Cheat Sheet — Git commands organised by what you want to do: undo the last commit, rename a branch, delete a remote branch. Modern switch/restore with classic equivalents and danger badges.
- Regex Cheat Sheet — Every regular expression token with a working example, support in JavaScript, PCRE/PHP, Python, Go, Java and .NET, and a Try it link that opens the regex tester pre-filled.
- Diff Checker — Compare two versions of a text, code or JSON file and see exactly which lines, words and characters changed.