Skip to the content

Contact usFree tools · No signup · Files stay on your device

Text Tools

Markdown cheat sheet: tables, task lists and code blocks

Markdown cheat sheet: tables, task lists and code blocks

Markdown looks simple until you need a table that lines up, a checklist that actually shows boxes, or a code sample that does not mangle your quotation marks. This cheat sheet gives you the exact syntax for the things people look up most, each with a short example you can paste into the free Markdown Previewer and check at once.

Everything below follows the GitHub Flavored flavour of Markdown that the previewer uses. If you are writing for a different app, preview first: support for tables and task lists is common but not universal.

Headings and emphasis

## Heading 2
### Heading 3
#### Heading 4

**bold**   _italic_   ~~strikethrough~~   `inline code`

The number of # signs sets the level, from one for the page title to six. A space after the hashes is required: #Title is plain text, not a heading. For emphasis, one asterisk or underscore gives italic and two give bold; three give both. In the previewer, the B, I and S toolbar buttons wrap your selection in **, _ and ~~ for you.

Lists

- Rice
- Dal
  - Masoor
  - Moong

1. Fill in the form
2. Attach photos
3. Submit

A bulleted list uses - or *. Indent a line by two or more spaces to nest it under the item above. For a numbered list you only need the first number to be right: a list written as 1., 1., 1. still renders as 1, 2, 3, which makes reordering lines painless.

One catch: a blank line between items turns a tight list into a loose one, with more space around every item. If your list looks oddly spread out, look for stray blank lines.

Task lists

- [x] Collect documents
- [x] Pay the fee
- [ ] Submit the application

A task list is a bulleted list where each item starts with [ ] for open or [x] for done. Both the dash and the space inside the brackets matter. - [ ]item without a space after the bracket is not a task, and the preview shows the brackets as plain text. In the previewer the result is a row of read-only checkboxes: you cannot tick them in the preview, so you edit the x in the text.

The toolbar's ☐ Task button adds - [ ] to every selected line, which is a quick way to turn a pasted to-do list into a checklist.

[Tech Solution Point](https://techsolutionpoint.com)
[With a hover title](https://example.com "Title text")
<https://example.com>
![Alt text for the picture](https://example.com/photo.png)

Square brackets hold the visible text and round brackets hold the address. Wrap a bare address in angle brackets, or just write it, and it becomes a link by itself. An image is a link with a ! in front, and the square brackets become its alternative text. Write something useful there, because that text is what screen readers and broken-image placeholders show.

In the previewer's own preview, links open in a new tab, so you can test them without losing your draft.

Code blocks

Wrap a short snippet in single backticks to get inline code. For several lines, use a fenced block:

```json
{
  "name": "Rahim",
  "phone": "01XXXXXXXXX"
}
```

The word after the opening fence, here json, labels the language. It does not change what you see in the previewer, but other tools use it for colouring. Inside a fence, nothing is formatted: asterisks, hashes and underscores print exactly as typed, which is what you want for code.

To show a fence inside a fence, open the outer one with four backticks. To put a backtick inside inline code, wrap the code in double backticks. The toolbar button marked with three backticks inserts a block labelled js, so edit the label if your code is something else.

Four spaces of indentation also make a code block, but fences are clearer and the only version that carries a language label.

Tables

| Item    | Qty | Price (Taka) |
| :------ | :-: | -----------: |
| Rice    |  2  |          130 |
| Dal     |  1  |          180 |

A table has three parts: a header row, a separator row, and data rows. The separator is what makes it a table, so never skip it. The colons set alignment:

Separator Alignment
:--- left
:---: centre
---: right

Right-align numbers, because it lines up the digits. The columns in your source do not need to be neatly padded; the pipes at the edges are optional too. This is a valid table:

Item | Price
--- | ---
Rice | 130

If a cell must contain a pipe character, write it as \|. Cells hold one line of inline Markdown, such as bold or a link, but not lists or paragraphs. For long text, keep the table short and put the detail below it.

The previewer's Table button inserts a starter with three columns and two rows, with a blank line kept above and below so it does not fuse with the paragraph before it.

Quotes and rules

> A quotation starts with a greater-than sign.
> It can run over several lines.

---

Three dashes, asterisks or underscores on their own line draw a horizontal rule. If you use dashes, leave a blank line above them: dashes directly under a line of text turn that line into a heading instead.

Line breaks and escaping

A single new line inside a paragraph is a space. Choose one of these when you want a real break:

  • Two spaces at the end of the line.
  • A backslash at the end of the line.
  • A blank line, which starts a new paragraph.

To print a symbol that Markdown would otherwise use, put a backslash before it: \*not italic\* shows as not italic with the asterisks visible.

How to test any of this in 30 seconds

  1. Open Markdown Previewer.
  2. Press Clear, then paste one of the examples above into the box titled "Markdown".
  3. Look at the panel titled "Preview". If a table or checklist did not appear, compare your text with the example: usually a space, a blank line or the separator row is missing.
  4. When the result is right, use Copy HTML for the converted body, or download the .md file with the .md button.

For the full tour of the page, read Markdown Previewer: the complete guide. If you want to see what changed between two drafts of a document, use the Text Diff Checker.

Mistakes that cost the most time

  • Missing the separator row under a table header.
  • Forgetting the space after #, - or ].
  • Expecting a single Enter to start a new line.
  • Putting a table or list directly after a paragraph with no blank line between them.
  • Assuming the app you publish in supports everything. Check with a preview, then check again in the destination.

Quick reference

You want You type
Bold **text**
Italic _text_
Strikethrough ~~text~~
Link [text](url)
Image ![alt](url)
Bullet - item
Numbered 1. item
Task - [ ] item
Quote > text
Inline code `code`
Rule ---

Frequently asked questions

How do I make a table in Markdown?
Write a header row with pipes, then a separator row of dashes, then your data rows: | Name | Price |, | --- | --- |, | Rice | 130 |. Add a colon in the separator to align a column: :--- left, :---: centre, ---: right.
How do I write a task list?
Start each line with a dash, a space and square brackets: - [ ] for an open task and - [x] for a finished one. The space inside the empty brackets is required.
How do I put a code block in Markdown?
Put three backticks on a line of their own, write the code, then close with three more backticks. Add a language name after the first three, such as js or json, to label the block.
Why is my Markdown line break ignored?
A single new line inside a paragraph is treated as a space. End the line with two spaces or a backslash for a line break, or leave a blank line for a new paragraph.
Does every Markdown app support tables and task lists?
No. They belong to GitHub Flavored Markdown, which many tools support but plain Markdown does not require. Paste your text into a previewer to see how it renders before you publish it elsewhere.
Found this useful? Share it

Tools in this guide

Main tool

Markdown Previewer

Write Markdown and see it rendered instantly, with GitHub-style tables, task lists and code blocks.

Open tool

Word Counter

Paste or type any text to get live word and character counts, reading and speaking time, a readability score and the keywords you use most.

Open tool

Text Diff Checker

Paste or open two versions of a text and see exactly what changed: added lines in green, removed lines in red.

Open tool

Back to all guides & blog