GameParticles
Text

Markdown Cheat Sheet: Syntax for Headings, Lists and Code

A Markdown cheat sheet with the syntax for headings, bold, italic, lists, links, images, code blocks and blockquotes, plus GitHub extras like task lists.

Updated

Markdown is a plain-text syntax that converts to HTML: # starts a heading, **text** makes bold, *text* makes italic, - starts a list item and [text](url) creates a link. The tables below cover the syntax you will use most, followed by the GitHub Flavored Markdown extras.

What Markdown is

John Gruber published Markdown in 2004, with input from Aaron Swartz, as a way to write for the web in text that stays readable as text. The original description left some edge cases undefined, so parsers drifted apart. CommonMark, started in 2014, is a strict specification that most modern tools follow. GitHub Flavored Markdown (GFM) builds on CommonMark and adds a few features.

You will meet Markdown in README files, documentation sites, static site generators, note-taking apps, and comment boxes on GitHub, Reddit and Discord. Files normally end in .md.

Text formatting

ElementMarkdownNotes
Bold**bold text**Two underscores on each side also work
Italic*italic text*One underscore on each side also works
Bold and italic***both***Three asterisks
Inline codeWrap the text in single backticksShown in a monospace font, formatting inside is ignored
Link[link text](https://example.com)Add a title in quotes after the URL for a tooltip
Image![alt text](image.png)Same as a link with ! in front
Escape\*not italic\*A backslash makes the next symbol literal

Headings

A heading is one to six # characters, a space, then the text. The number of # characters sets the level.

  • # Heading 1
  • ## Heading 2
  • ### Heading 3
  • #### Heading 4
  • ##### Heading 5
  • ###### Heading 6

Always put a space after the # characters. Some older parsers accepted #Heading, but CommonMark does not. Use one level 1 heading per document and do not skip levels, since headings become the page outline used by screen readers and tables of contents.

Paragraphs and line breaks

  • A blank line separates paragraphs.
  • A single newline inside a paragraph is treated as a space, so you can wrap long lines in your editor without changing the output.
  • For a hard line break, end the line with two or more spaces. CommonMark also accepts a backslash at the end of the line.
  • Three or more hyphens, asterisks or underscores on a line of their own, such as ---, make a horizontal rule.

Lists

List typeMarkdownNotes
Bulleted- item* and + work as bullets too
Numbered1. itemThe numbers in the source do not have to be in order
NestedIndent the child item under its parentTwo to four spaces, aligned with the parent's text

A numbered list takes its starting number from the first item and counts up from there, so many writers number every item 1. and let the renderer do the counting. To put a second paragraph or a code block inside a list item, indent it to line up with the item's text.

Blockquotes

Start each line with > and a space:

  • > This is a quoted line.
  • > It continues here.

Consecutive quoted lines form one blockquote. Quotes can contain other Markdown, including lists and nested quotes written as >>.

Code

Inline code uses single backticks around the text. For a block of code there are two forms:

  • Fenced block. Put three backticks on a line of their own, then the code, then three backticks on another line. Add a language name such as js or python right after the opening backticks to request syntax highlighting where the renderer supports it.
  • Indented block. Indent every line by four spaces. This is the original syntax; fenced blocks are easier to read and are part of CommonMark.

Nothing inside a code block is interpreted as Markdown, so asterisks and # characters appear exactly as typed.

Links and images in more detail

  • Inline link: [GameParticles](https://gameparticles.com)
  • Link with a title: [GameParticles](https://gameparticles.com "Free tools")
  • Automatic link: <https://example.com> turns the URL itself into a link
  • Reference link: write [link text][docs] in the paragraph and define [docs]: https://example.com/docs on its own line anywhere in the document
  • Image: ![A red bicycle](bike.jpg)

Reference links keep long URLs out of your sentences and let you reuse one URL in several places. Markdown has no syntax for image size or alignment; where a renderer allows raw HTML you can use an img tag for that.

GitHub Flavored Markdown extras

These are not part of CommonMark, but they work on GitHub and in many editors and note apps.

FeatureMarkdownResult
Strikethrough~~removed~~Text with a line through it
Task list, open- [ ] write testsAn empty checkbox
Task list, done- [x] write testsA ticked checkbox
Autolinkhttps://example.comBare URLs become links without angle brackets
TablePipes between cells, hyphens under the headerA table with optional column alignment

A table is written with pipes between cells and a row of hyphens under the header:

  • | Name | Role |
  • | --- | --- |
  • | Ada | Engineer |

Tables have enough rules of their own, including alignment, escaped pipes and line breaks in cells, to fill a separate guide: see Markdown table syntax. GitHub also supports footnotes written as [^1], which are a GitHub feature outside the GFM specification.

Common mistakes

  • No blank line before a list or a heading. Some parsers need one to recognize the block.
  • Missing space after #, - or 1.
  • Unescaped special characters. To show a literal asterisk, underscore or backtick, put a backslash in front, as in \*.
  • Underscores inside words. snake_case_name stays literal in CommonMark, but older parsers may italicize the middle. Put identifiers in inline code to be safe.
  • Assuming every extra works everywhere. Tables, task lists and strikethrough depend on the renderer.

Checking how your Markdown renders

The quickest way to learn the syntax is to type it and watch the output. The Markdown Preview shows an editor and the rendered result side by side and updates as you type. To get the HTML itself, the Markdown to HTML converter shows formatted HTML source with a copy button, plus a preview tab.

Both tools handle the core syntax on this page: headings from level 1 to 6, bold and italic written with asterisks, inline code, fenced code blocks, links, blockquotes, bulleted lists, horizontal rules and basic tables. They do not currently render numbered lists as list elements, images, underscore emphasis, nested lists, strikethrough or task lists, so check those features in the application where your document will be published.

More converters and formatters are in the text category.

Try it

Open the Markdown Preview, type a heading, a bulleted list and a fenced code block, and watch the rendered version appear beside it. When it looks right, paste the same text into the Markdown to HTML converter to copy the HTML.

Tools in this guide

Frequently asked questions

What is Markdown?

Markdown is a plain-text formatting syntax created by John Gruber in 2004. You mark up text with simple characters such as # for headings and asterisks for emphasis, and a converter turns it into HTML. Files usually use the .md extension.

What is the Markdown syntax for a link?

Put the link text in square brackets followed immediately by the URL in parentheses, for example [Example](https://example.com). An image uses the same pattern with an exclamation mark in front, and the bracketed text becomes the alt text.

How do I add a line break in Markdown?

Leave a blank line to start a new paragraph. For a line break inside a paragraph, end the line with two or more spaces, or with a backslash in CommonMark-based parsers. A single newline on its own is treated as a space.

What is the difference between Markdown and GitHub Flavored Markdown?

GitHub Flavored Markdown, or GFM, is a superset of the CommonMark specification. It adds tables, task lists, strikethrough and automatic linking of bare URLs. Standard Markdown documents work unchanged in GFM, but GFM extras may not render elsewhere.

More text guides

JSON Formatter
Developer · Format, validate and minify JSON with syntax highlighting.
↵
Base64 Encode / Decode
Developer · Encode text to Base64 or decode Base64 back to plain text.
↵
URL Encoder / Decoder
Developer · Encode or decode URL components and query strings.
↵
Hash Generator
Developer · Generate MD5, SHA-1, SHA-256 and SHA-512 hashes.
↵
UUID Generator
Developer · Generate UUIDs v4 (random) in bulk with one click.
↵
Regex Tester
Developer · Test regular expressions against text with live match highlighting.
↵
Word Counter
Text · Count words, characters, sentences, paragraphs and reading time.
↵
Case Converter
Text · Convert text between UPPER, lower, Title, camelCase, snake_case and more.
↵
List Sorter
Text · Sort, reverse, deduplicate and shuffle lists of text.
↵
Markdown Preview
Text · Write Markdown and see a live rendered preview side by side.
↵
Percentage Calculator
Numbers · Calculate percentages, increases, decreases and what % one number is of another.
↵
Color Converter
Colors · Convert colors between HEX, RGB, HSL and HSV instantly.
↵
Snake
Arcade · Eat food, grow longer, don't hit the walls. A timeless classic.
↵
2048
Puzzle · Slide tiles and combine them to reach the legendary 2048 tile.
↵
Word Grid
Puzzle · Guess the hidden five letter word in six tries using color clues.
↵
Sudoku
Puzzle · Fill the 9x9 grid with logic. Four difficulties from easy to expert.
↵
Minesweeper
Strategy · Use number clues to clear the minefield. Classic logic, three levels.
↵
Breakout
Arcade · Smash every brick with paddle and ball. Power-ups, combos, endless levels.
↵
Typing Practice
Casual · Build your WPM and accuracy with timed drills from 30 seconds to 5 minutes. Find your weak keys.
↵
TypeRunner
Arcade · Multiplayer typing race. Race friends by link, beat computer runners, or chase your own ghost.
↵
Typing Blocks
Arcade · Type each word before its wooden block lands. Miss, and the pile climbs toward the line.
↵
Bubble Shooter
Arcade · Aim, bank shots off the walls, and pop groups of three or more bubbles.
↵
Road Rush
Arcade · Race seven rivals through traffic and punch your way to the front.
↵