How to Indent in Markdown
Indenting paragraphs, nested lists, list content, and code, plus the spacing rules that decide whether an indent nests, disappears, or turns into a code block.
Short answer
Markdown has no indent for ordinary text: up to 3 leading spaces are dropped, and 4 or more (or a tab) at the start of a block make a code block. To indent a paragraph's first line, start it with   or a few . To nest a list item, line it up under the parent's text: 2 spaces under -, 3 under 1.. To set a whole block in, use >.
Indent a Paragraph
Spaces at the start of a paragraph do not indent it. CommonMark strips up to 3 of them, and 4 or more start a code block. For a visual indent, type an HTML entity at the start of the line. The parser turns it into a real non-breaking or em-width space, which is not stripped and not collapsed.
This first line is indented with four non-breaking spaces.
 This one starts with a single em space.This first line is indented with four non-breaking spaces.
This one starts with a single em space.
is one regular-width space; repeat it.   is as wide as the letter M, so one is a typical paragraph indent.   is half that.
Three leading spaces are dropped.
Four leading spaces make a code block.Three leading spaces are dropped.
Four leading spaces make a code block.
The first paragraph renders flush left. The second becomes a code block.
A normal paragraph.
> A whole block set in from the margin.
> Markdown treats it as a quotation.A normal paragraph.
A whole block set in from the margin. Markdown treats it as a quotation.
Every line is set in, with a quote bar in most themes. Use it when the text really is a quote or callout.
<p style="text-indent: 2em"> indents on a static site you control, but GitHub strips style attributes, so the entity method is the one that works in a README.Indent a Bullet List
A nested item belongs to the item above it when its marker sits at or past the start of the parent's text. Under - that is 2 spaces. Up to 3 more still nest, so 4 spaces works too, which is what Python-Markdown (MkDocs) requires.
- Fruits
- Apple
- Banana
- Vegetables
- Carrot- Fruits
- Apple
- Banana
- Vegetables
- Carrot
Indent a Numbered List
A number marker is wider, so the child moves over with it: 3 spaces under 1. , 4 under 10. . The full nesting rules are in the nested lists guide.
1. Phase one
1. Task A
2. Task B
2. Phase two
- Task C- Phase one
- Task A
- Task B
- Phase two
- Task C
Indent Content Inside a List Item
A second paragraph, a code block, or an image belongs to a list item when it is indented to the item's text. Leave a blank line before it.
- First paragraph of this item.
Second paragraph, indented 2 spaces
so it stays inside the same item.
- Second itemFirst paragraph of this item.
Second paragraph, indented 2 spaces so it stays inside the same item.
Second item
1. Item one.
Continuation paragraph under item one.
Three spaces, the width of "1. ", keep it inside.
2. Item two.Item one.
Continuation paragraph under item one. Three spaces, the width of "1. ", keep it inside.
Item two.
- Run this command:
npm install
- Then start the server.Run this command:
npm installThen start the server.
The item's text starts at column 2, so the code needs 2 + 4 = 6 spaces. A ``` fence only needs the 2.
When Indentation Becomes a Code Block
Four or more spaces at the start of a new block make an indented code block. It cannot interrupt a paragraph, so a 4-space line directly under paragraph text just continues the paragraph; after a blank line, it is code. Fenced blocks with three backticks are clearer and allow a language hint.
A normal paragraph.
function hello() {
return "indented code block"
}
Another normal paragraph.A normal paragraph.
function hello() {
return "indented code block"
}
Another normal paragraph.
Tabs vs Spaces
CommonMark does not swap tabs for a fixed number of spaces. Where indentation matters, a tab moves to the next tab stop, and tab stops are every 4 columns. In practice:
- A tab at the start of a line counts as 4 spaces, so a line that starts with a tab after a blank line is a code block.
- A tab before a nested
-reaches column 4, which nests under both-and1.parents. - Editors disagree about what the Tab key inserts. Obsidian's Tab indents the selected list items; other editors insert a tab or a configured number of spaces. Spaces render the same everywhere.
Indent with Blockquotes
Each > sets text in one more level. The space between the > characters is optional. More on line breaks, attribution, and callouts in the blockquote guide.
> Outer quote
> > Inner quote
> > > Deepest quoteOuter quote
Inner quote
Deepest quote
Common Mistakes
Indentation goes wrong in three ways: too little, too much, or in the wrong place for a paragraph.
Broken
- Parent
- ChildFixed
- Parent
- ChildBroken
1. Parent
- ChildFixed
1. Parent
- ChildBroken
- Parent
- ChildFixed
- Parent
- ChildBroken
Some text.
I wanted an indent, not code.Fixed
Some text.
 I wanted an indent, not code.Broken
- Item one.
Continuation of item one.Fixed
- Item one.
Continuation of item one.Quick Reference
| Syntax | Result | Notes |
|---|---|---|
|  Text | First-line indent | One em-wide space |
| Text | First-line indent | One space per entity |
| - item - child | Nested bullet | 2 spaces under - |
| 1. item - child | Nested under number | 3 spaces under 1. |
| - item More text | Second paragraph in item | Indent to the item's text |
| code line | Indented code block | 4+ spaces or a tab, new block |
| > quote > > nested | Indented quote block | One > per level |
Platform Support
Document renderers follow CommonMark. Python-Markdown and the chat apps are where the numbers change.
| Platform | Supported? | Notes |
|---|---|---|
| CommonMark / GFM | Yes | Lists nest by the parent's content column, 4 spaces start a code block, and tabs count to the next multiple of 4. |
| GitHub | Yes | CommonMark rules. and   work; style attributes such as text-indent are stripped. |
| GitLab | Yes | CommonMark rules; its docs say to indent continuation paragraphs to the start of the item's text. |
| VS Code preview | Yes | CommonMark rules through markdown-it. |
| Obsidian | Yes | Tab and Shift+Tab indent list items. A Tab or 4 spaces makes a code block. |
| MkDocs (Python-Markdown) | Partial | Nested list content needs 4 spaces (or a tab) per level, not 2. |
| Yes | Sublists need 2 spaces under a bullet, 3 under a number. 4-space code blocks work on old and new Reddit. | |
| Notion | Partial | Tab nests a block under the one above it, and Shift+Tab un-nests it. |
| Discord | Partial | 2 spaces before - or * indents a list item. Code blocks use ``` fences, not indentation. |
| Slack | Partial | mrkdwn has no list or indent syntax. The composer builds lists as you type; apps can send nested lists in a markdown block. |
Frequently Asked Questions
How do I indent in Markdown?
It depends on what you are indenting. For a nested list item, indent it to the parent's text: 2 spaces under -, 3 under 1. For the first line of a paragraph, start it with or  . For a whole block, use a > blockquote. Plain leading spaces do not indent normal text.
How do I indent a paragraph in Markdown?
Markdown has no paragraph-indent syntax. Up to 3 leading spaces are ignored, and 4 or more make a code block. For a visual first-line indent, type HTML entities at the start of the line: (one space each, repeat it) or   (one em-wide space). Where HTML styles are allowed you can use CSS text-indent, but GitHub strips style attributes.
Why does my indented text turn into a code block?
Four or more spaces, or a tab, at the start of a new block create an indented code block. That only happens when the line is not continuing a paragraph, which is why it usually bites after a blank line. Inside a list, the 4 spaces are counted from the item's text, not from the left margin.
How do I indent without creating a code block?
Use fewer than 4 spaces for list nesting (2 under -, 3 under 1.), use or   entities for a visual indent, or use > for an indented block. Leading spaces alone never indent a normal paragraph.
How do I indent a bullet point or nested list?
Put the child's marker under the first character of the parent's text. That is 2 spaces under a - item and 3 under a 1. item. Python-Markdown (MkDocs) is stricter and wants 4 spaces per level, and 4 also works in CommonMark, so 4 is the portable choice.
Is a tab 4 spaces in Markdown?
For structure, effectively yes. CommonMark keeps tabs as tabs, but when they affect indentation it treats them as moving to the next tab stop, at multiples of 4 columns. So a tab at the start of a line counts as 4 spaces and makes a code block, while a tab after a list marker only reaches the next stop. Spaces are more predictable across editors.
How do I put a code block inside a list item?
Indent a fenced block to the item's text: 2 spaces under -, 3 under 1. An indented (4-space) code block needs the item's indent plus 4, so 6 spaces under a - item. Leave a blank line before it.
How do I add a second paragraph to a list item?
Leave a blank line after the first paragraph, then indent the next one to the same column as the item's text. Without the indent, the paragraph ends the list.
How do I nest a blockquote?
Add another > for each level: > outer, > > inner. The space between them is optional; >> works too.
Do Slack and Discord support indentation?
Discord indents a list item when you put 2 spaces before the - or *. Slack's mrkdwn has no list or indent syntax; its composer creates lists as you type, and apps can send nested lists in a Block Kit markdown block.