Markdown Bullet Points and Nested Lists: Indentation Rules That Work
How to make bullet points and nested sub-bullets in Markdown: the indentation rule that decides whether nesting works, numbered sublists, code blocks inside list items, and the mistakes that flatten a list.
A nested list in Markdown is a list inside a list item. It works with one rule: the child list has to be indented far enough to line up with the text of its parent item. Most "my sub-bullets are broken" questions come from missing that rule, so this post starts there.
Bullet points and sub-bullets
Start a bullet with -, * or +, followed by a space. Indent the child bullet by two spaces:
- Fruit
- Apple
- Pear
- Conference
- Comice
- Vegetables
- Fruit
- Apple
- Pear
- Conference
- Comice
- Vegetables
Two spaces works because the text of - Fruit starts in the third column (after the dash and the space). A child bullet that starts in that column or further right belongs to the parent.
The indentation rule
In CommonMark and GitHub Flavored Markdown, a child block belongs to a list item when it is indented to the column where the item's text starts. That column depends on the marker:
| Parent marker | Text starts at column | Indent the child by |
|---|---|---|
- item |
3 | 2 spaces |
1. item |
4 | 3 spaces |
10. item |
5 | 4 spaces |
This is why a bullet nested under a numbered item needs three spaces, and why two spaces under 1. quietly produces a flat list.
If you want one habit that works almost everywhere, use four spaces per level. Some older and stricter parsers, Python-Markdown for example, only recognize nesting at four spaces. Four spaces is also safe in CommonMark for bullet lists, because the child is still less than four columns past the parent's text, so it is not read as a code block.
Numbered lists with sub-bullets
1. Install the package
- Use npm or yarn
- Pin the version
2. Configure it
1. Create the config file
2. Add your keys
3. Run the build
- Install the package
- Use npm or yarn
- Pin the version
- Configure it
- Create the config file
- Add your keys
- Run the build
Each child is indented three spaces because 1. is three characters wide. Only the first number of an ordered list matters in CommonMark, so 1. 1. 1. renders as 1, 2, 3. Many people number every item 1. so inserting an item never means renumbering. Not every renderer follows that rule, so preview the result where it will be published.
Common mistakes
| What you see | Cause | Fix |
|---|---|---|
| Sub-bullets show up flat | Indent is smaller than the parent's text column | Indent 2 spaces under -, 3 under 1., or use 4 everywhere |
| Sub-bullet becomes a code block | Indented 4 or more columns past the parent's text | Remove spaces so it is 2 to 3 past the parent |
| A new list starts instead of continuing | Marker changed from - to * or + mid-list |
Use the same marker for the whole list |
| Numbered list restarts at 1 after a paragraph | The paragraph broke the list | Indent the paragraph to the item's text column |
Extra space and <p> tags around items |
A blank line between items makes the list "loose" | Remove the blank lines if you want tight spacing |
| List glued to the paragraph above it | Some renderers need a blank line before a list | Put a blank line before the first bullet |
| Mixed tabs and spaces nest oddly | A tab counts as up to four spaces | Use spaces only |
Two details worth knowing. A bullet list can interrupt a paragraph in CommonMark, but an ordered list only can if it starts at 1. So text followed directly by 2. item is plain text, not a list. And switching markers is a feature when you want it: changing from - to * at the same level ends one list and starts another.
Paragraphs and code inside a list item
Add a blank line and indent to the item's text column to keep extra content inside the same item:
1. Clone the repo
Make sure you use the SSH URL.
```bash
git clone git@github.com:you/project.git
```
2. Install dependencies
The paragraph and the fenced block each carry three spaces, matching 1. . Lose that indent and the code fence ends the list, so the next number starts again at 1.
Task lists inside nested lists
On GitHub and in most modern renderers, a checkbox goes right after the marker, and you can nest tasks under tasks:
- [x] Ship the tool
- [x] Write the code
- [ ] Add the docs page
- [ ] Announce it
If you need ready-made checklists, the Markdown checklist generator builds them, and the checkbox syntax guide covers where task lists render.
Fixing a list someone else broke
Lists pasted from Word, Google Docs, Slack or a chatbot usually arrive with inconsistent indentation, which is exactly the situation the rule above punishes. Paste it into the Markdown nested list formatter to rebuild the nesting with consistent indents, then check the result in the live preview editor. If tabs are the culprit, the Markdown linter flags hard tabs used for indentation.
Quick reference
| Goal | Syntax |
|---|---|
| Bullet | - item |
| Sub-bullet | 2 spaces, then - item (3 under a numbered item) |
| Numbered | 1. item |
| Task | - [ ] item |
| Paragraph in an item | Blank line, then indent to the item's text |
| Safe default | 4 spaces per level, same marker throughout |
Related: Markdown syntax cheat sheet and Markdown table syntax, which have their own indentation traps.