Markdown Cheat Sheet: Syntax Basics
Dev Nexus4 min read
The Markdown syntax you'll actually use every day - headings, lists, links, code and tables - in one quick reference.
Markdown is everywhere - READMEs, GitHub comments, docs sites, wikis, chat apps and note tools all speak it. The good news is that the syntax you need day to day fits on a single page.
This cheat sheet covers the essentials: headings, emphasis, lists, links, images, code, blockquotes and tables. Keep it handy, and paste anything you're unsure about into a live previewer to see it render.
The Problem
Markdown's appeal is that it's simple - but "simple" isn't the same as "obvious." It's easy to forget whether a table needs a divider row, how many spaces nest a list, or which characters make text bold versus italic.
Guessing leads to broken output: a list that collapses into one line, a code block that never closes, a table that renders as raw pipes. The fix is a short reference for the syntax you actually use, plus a way to check the result before you publish.
The Solution
This page is that reference. Below are the pieces of Markdown you'll reach for most, with the exact syntax for each. Everything here is standard Markdown, with the GitHub Flavored extras (task lists, tables, strikethrough) that most tools support.
When you want to confirm something renders correctly, paste it into the Markdown Preview tool and watch it turn into formatted output live. And if you're checking how the resulting HTML behaves as a page, the HTML Preview tool picks up where this leaves off.
Step-by-Step Guide
- 1
Headings and emphasis
Use
#for headings - one#is an H#,##an H##, down to######for Hundefined. Put a space after the hashes and a blank line before the heading.For emphasis:
*italic*or_italic_,**bold**, and***bold italic***. Strikethrough is~~text~~. Inline code goes in single backticks: `code`. - 2
Lists and task lists
Unordered lists use
-,*or+at the start of a line. Ordered lists use1.,2.,3.- the numbers don't even have to be right, they renumber automatically.Nest a list by indenting two (or four) spaces. GitHub task lists use
- [ ] todoand- [x] done. Always leave a blank line before the first list item. - 3
Links, images and blockquotes
A link is
[text](https://example.com); add a title with[text](https://example.com "Title"). An image is the same with a leading!:.A blockquote starts each line with
>. Stack>>for nested quotes. Leave a blank line before the quote so it renders as its own block. - 4
Code blocks and tables
Fence a code block with three backticks on their own lines, and add a language after the opening fence for highlighting: ```
`js``. Close it with a matching`` or it swallows the rest of the document.Tables use pipes and a divider row:
| A | B |on the header line, then|---|---|beneath it, then your rows. Add colons in the divider (:---,:---:,---:) to left-, center- or right-align a column.
Common Mistakes
No blank line before a block
Lists, headings, blockquotes, tables and code fences need a blank line before them. Without it, Markdown treats the block as part of the previous paragraph and it renders as one run-on line.
Forgetting the table divider row
A table only renders if the
|---|---|divider row sits directly under the header. Miss it and you get literal pipe characters instead of a table.Unclosed code fences
Every opening ``
needs a closing``. An unclosed fence turns everything after it into code. Preview your Markdown to catch this instantly.Assuming raw HTML always works
Many renderers escape raw HTML for safety and show it as text. Prefer Markdown syntax, and only fall back to HTML where a tool explicitly allows it.
Frequently Asked Questions
What's the difference between italic and bold?
One asterisk or underscore makes italic (*italic*), two make bold (**bold**), and three make bold italic (***both***). Strikethrough uses two tildes: ~~text~~.
How do I write a table in Markdown?
Put your columns between pipes on the header row, add a |---|---| divider row directly beneath it, then one row per line. Use colons in the divider to control column alignment.
How do I add a code block with syntax highlighting?
Fence the block with three backticks on their own lines and write the language name right after the opening fence, e.g. ```js. Close it with a matching set of three backticks.
Is this GitHub Flavored Markdown?
The core syntax is standard Markdown; task lists, tables and strikethrough are GitHub Flavored Markdown extras that most modern tools, including the Markdown Preview tool, support.
Where can I test this syntax?
Paste any snippet into the Markdown Preview tool and watch it render live in your browser - nothing is uploaded, so it's safe for private drafts.
Try the Tool
Markdown Preview
Try any syntax from this cheat sheet in a live Markdown previewer - render it instantly, nothing to install.
Related Tools
Related Articles
How to Preview Markdown Online
See your Markdown rendered live as you type - headings, lists, tables and code - right in your browser, with nothing to install.
Read articleAre UUIDs Really Unique?
In practice UUIDs never collide - here is the math behind why, and the one thing people get wrong: a UUID is an identifier, not a secret.
Read articleencodeURI vs encodeURIComponent Explained
The clear difference between encodeURI and encodeURIComponent, with examples showing which one to use for a value versus a whole URL.
Read article