Markdown Cheat Sheet with Examples

Every Markdown syntax element on one page (core Markdown plus the GitHub Flavored Markdown extensions), with a dedicated deep-dive guide for each element.

Updated

Quick Reference

ElementSyntaxGuide
Heading# H1 ## H2 ### H3Details →
Bold**bold text**Details →
Italic*italic text*Details →
Bold + italic***both***Details →
Strikethrough~~crossed out~~Details →
Link[text](https://url.com)Details →
Image![alt text](image.png)Details →
Unordered list- itemDetails →
Ordered list1. itemDetails →
Checkbox (task)- [ ] todo - [x] doneDetails →
Blockquote> quoted textDetails →
Inline code`code`Details →
Code block```js … ```Details →
Table| A | B | |---|---|Details →
Line breaktwo trailing spaces or \Details →
Horizontal rule----
Definition listTerm : definitionDetails →
Footnote (GFM)text[^1] [^1]: note-
Escape character\* literal asterisk-

Syntax Guides

Each guide covers the exact syntax, a rendered example, GitHub Flavored Markdown behavior, and the mistakes that most often break rendering.

Markdown Headings

Create a heading in Markdown by starting a line with 1–6 hash characters (#) followed by a space. One # is an H1, two ## an H2, down to ###### for H6.

Bold and Italic in Markdown

Make text bold in Markdown by wrapping it in two asterisks (**bold**) and italic by wrapping it in one (*italic*). Three asterisks give you both: ***bold italic***.

Markdown Links

Create a link in Markdown with square brackets around the link text followed immediately by the URL in parentheses: [link text](https://example.com).

Markdown Images

Embed an image in Markdown with an exclamation mark, alt text in square brackets, and the image URL in parentheses: ![alt text](image.png).

Markdown Lists

Create an unordered list in Markdown by starting lines with a hyphen, asterisk, or plus sign (- item). Create an ordered list by starting lines with a number and period (1. item).

Markdown Checkboxes (Task Lists)

Create a checkbox in Markdown with a list item followed by square brackets: "- [ ]" for an unchecked box and "- [x]" for a checked one. This is GitHub Flavored Markdown task list syntax.

Markdown Tables

Create a table in Markdown with pipes (|) separating columns and a row of hyphens under the header. Colons in the separator row control column alignment.

Markdown Code Blocks

Write inline code in Markdown by wrapping it in single backticks (`code`), and multi-line code blocks by fencing them with triple backticks (```) on their own lines. Add a language name after the opening fence for syntax highlighting.

Markdown Blockquotes

Create a blockquote in Markdown by starting the line with a greater-than sign and a space: "> quoted text". Repeat the > on each line, or on blank lines between paragraphs, to continue the quote.

Markdown Strikethrough

Cross out text in Markdown by wrapping it in double tildes: ~~struck through~~. Strikethrough is a GitHub Flavored Markdown extension supported by most modern renderers.

Line Breaks in Markdown

Force a line break in Markdown by ending the line with two spaces, or with a backslash, or by inserting the HTML tag <br>. A single newline alone does not break the line. It joins into the same paragraph.

Markdown Definition Lists

Write a definition list in Markdown (where supported) by putting the term on one line and each definition on the next line prefixed with a colon and space. GitHub does not support this syntax, so use bold terms with indented text as a portable fallback.

Markdown Callouts (Alerts & Admonitions)

Create a callout in Markdown by starting a blockquote with an alert type in brackets: "> [!NOTE]" on the first line, then "> your text" on the lines below. GitHub supports five types: NOTE, TIP, IMPORTANT, WARNING and CAUTION. GitLab and Obsidian use the same pattern; everywhere else, fall back to a blockquote with a bold label.

Collapsible Sections in Markdown

Markdown has no native collapsible syntax, so use the HTML <details> and <summary> tags. The summary text becomes the clickable label, and everything else inside <details> stays hidden until the reader expands it. Leave a blank line after the summary line so Markdown inside the section renders. GitHub, GitLab and most HTML-friendly renderers support it.

Escaping Characters in Markdown

Escape a character in Markdown by putting a backslash in front of it: \* displays a literal asterisk instead of starting italics. In CommonMark and GitHub Flavored Markdown, any ASCII punctuation character can be backslash-escaped. Inside inline code and code blocks no escaping is needed, because everything there is already shown literally.

Markdown Horizontal Rules (Dividers)

Create a horizontal rule (a divider line) in Markdown by putting three or more hyphens (---), asterisks (***) or underscores (___) alone on a line. All three produce the same <hr> element. Leave a blank line above a --- rule, otherwise the line of text directly above it becomes a heading instead of being followed by a divider.

Page Breaks in Markdown

Markdown has no native page break syntax, because it was designed for the screen rather than the printed page. To start a new page in a PDF, put a converter-specific marker on its own line, most commonly the HTML <div style="page-break-after: always;"></div>, which MDTool and HTML-to-PDF exporters honor. Pandoc users write \newpage instead.

Frequently Asked Questions

What is Markdown?

Markdown is a plain-text formatting syntax created by John Gruber in 2004. Symbols like # and ** mark up structure (headings, bold, lists), and a renderer converts the text into HTML, PDF, or Word documents.

What is the difference between Markdown and GitHub Flavored Markdown (GFM)?

GFM is GitHub’s superset of CommonMark. It adds tables, task-list checkboxes, strikethrough, autolinks, and fenced code blocks with syntax highlighting: the elements most developers consider "normal Markdown" today.

What file extension do Markdown files use?

The standard extension is .md (also .markdown). A Markdown file is plain text, so any text editor can open it.

How do I convert a Markdown file to PDF or Word?

Paste the Markdown into a converter like MDTool’s Markdown to PDF or Markdown to Word tool. Both run free in the browser with no signup, and preserve tables, checkboxes, and code blocks.