Markdown Cheat Sheet
Markdown syntax for READMEs, docs and comments, with examples.
About Markdown cheat sheet
Markdown is a plain-text format that converts to HTML: # for headings, asterisks for emphasis, brackets for links. It's used for READMEs, documentation sites, issue trackers, chat apps and note-taking tools because it's readable even before it's rendered. CommonMark is the specification most renderers follow today, so the basic syntax behaves the same almost everywhere.
GitHub Flavored Markdown (GFM) adds tables, task lists, strikethrough and automatic links on top of CommonMark, and GitHub adds its own extras such as alerts and footnotes. Other platforms support different subsets, so check the second table against where your text will appear. Try any snippet in the Markdown preview to see it rendered.
Basic syntax
| Markdown | Result | Note |
|---|---|---|
| # Heading 1 | Heading, level 1 to 6 with # to ###### | ## Section |
| **bold** | Bold | __bold__ works too |
| *italic* | Italic | _italic_ works too |
| ***bold italic*** | Bold and italic | |
| `code` | Inline code | |
| [text](https://example.com) | Link | [text](url "title") adds a tooltip |
|  | Image | Alt text describes the image for screen readers |
| > quote | Block quote | Nest with >> |
| - item | Bulleted list | * or + also work |
| 1. item | Numbered list | Numbering starts from the first number |
| --- | Horizontal rule | *** or ___ also work |
| Line one Line two | Line break: end a line with two spaces or a backslash | A blank line starts a new paragraph |
| \*not italic\* | Escape a Markdown character with a backslash |
GitHub Flavored Markdown
Extensions supported by GitHub, GitLab, many editors and the Markdown preview tool.
| Markdown | Result | Note |
|---|---|---|
| ```js code ``` | Fenced code block with a language for highlighting | ~~~ fences also work |
| | A | B | | --- | --- | | 1 | 2 | | Table | :--- left, :---: center, ---: right aligns a column |
| - [ ] task - [x] done | Task list | |
| ~~strikethrough~~ | Strikethrough | |
| https://example.com | Autolinked URL | Becomes a link without brackets |
| Footnote[^1] [^1]: Note | Footnote (GitHub; not every renderer) | |
| > [!NOTE] > Text | Alert box (GitHub only) | NOTE, TIP, IMPORTANT, WARNING, CAUTION |
Good to know
Raw HTML
Most renderers let you mix HTML into Markdown, for example <details> for collapsible sections. Many sites, GitHub included, strip scripts, styles and some attributes for security, so stick to simple elements.
More references
- HTTP status codesEvery HTTP status code and what it means
- MIME typesCommon MIME types by file extension
- ASCII tableAll 128 ASCII codes in dec, hex, octal and binary
- HTML entitiesNamed HTML entities with their codes
- Regex cheat sheetRegular expression syntax at a glance
- Cron examples30 common cron schedules explained
- Chmod examplesCommon Unix permissions like 644 and 755
- Unix timestamp referenceNotable epochs, the 2038 problem and code
- Git cheat sheetEveryday Git commands in one place