Markdown Indent: 5 Ways to Indent Text

Nested lists, blockquotes, HTML, and other methods that actually work

Quick Answer

Markdown has no general-purpose indent command. Leading spaces in regular paragraphs are stripped — typing four spaces before a line does not create a visual indent. Instead, Markdown uses indentation structurally: to nest lists, to create code blocks, and to continue block elements.

To indent text, choose the method that fits your use case:

GoalMethod
Indent a list itemNested list (2–4 spaces before marker)
Indent a paragraph visuallyBlockquote > or HTML  
Indent codeFenced code block or 4-space indent
Custom left marginHTML <div style="margin-left:2em">

Method 1: Nested Lists

The most natural way to indent in Markdown is nesting list items. Add spaces before the list marker (-, *, or a number) to create a sub-level:

  • First level
    • Second level (indented)
      • Third level (double indent)
  • Back to first level
- First level
  - Second level (indented)
    - Third level (double indent)
- Back to first level

How many spaces?

The number of spaces needed depends on the Markdown processor:

ProcessorSpaces to nest
CommonMark / GitHub2 spaces (or match parent marker width)
Classic Markdown4 spaces or 1 tab
GitLab2 or 4 spaces

Using 2 spaces works on most platforms. If nesting does not render, try 4.

Method 2: Blockquote Indent

A blockquote (>) creates a visual indent with a left border. It is not semantically an "indent" — it means "quoted text" — but it is widely used as a quick way to set text apart.

Regular paragraph.

This text is visually indented with a blockquote.

Back to normal.

Regular paragraph.

> This text is visually indented with a blockquote.

Back to normal.

You can nest blockquotes for deeper indentation:

First level

Second level

Third level

> First level
>> Second level
>>> Third level

Method 3: Non-Breaking Spaces (&nbsp;)

For a visual text indent without any structural meaning, use HTML non-breaking space entities. Each &nbsp; adds one space that Markdown processors do not strip:

    This paragraph has a 4-space indent.

        This one has an 8-space indent.

&nbsp;&nbsp;&nbsp;&nbsp;This paragraph has a 4-space indent.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This one has an 8-space indent.

This is verbose but works on every platform, including GitHub. Use it when you need a paragraph-level text indent and nothing else fits.

Method 4: Indented Code Blocks

In classic Markdown, 4 spaces or 1 tab at the start of a line creates a code block. This is structural, not visual — the text renders in a monospace font:

This is a code block created by 4 spaces.
    This is a code block created by 4 spaces.

Gotcha: if you indent a regular paragraph with 4 spaces intending a visual indent, it becomes a code block instead. This is the most common surprise with Markdown indentation.

For code, prefer fenced code blocks (triple backticks) — they are clearer, support syntax highlighting, and do not conflict with list indentation.

Method 5: HTML Margin

For full control over indentation on platforms that support style attributes, use an HTML block with a left margin:

This paragraph has a 2em left margin.

<p style="margin-left: 2em;">This paragraph has a 2em left margin.</p>

Warning: GitHub and GitLab strip style attributes. This works only in local Markdown apps (MDViewer, Typora, Obsidian, VS Code) and self-hosted documentation sites. For GitHub, use &nbsp; or the align attribute.

Common Mistakes

Leading spaces are ignored

This is the main trap. Regular Markdown paragraphs strip leading whitespace:

   This text has 3 leading spaces.
It renders the same as this line — no indent.

4 spaces create a code block, not an indent

If you add exactly 4 spaces (or a tab) to indent text, it becomes monospace code instead of an indented paragraph. Use &nbsp; or a blockquote for visual indentation.

Inconsistent nesting depth

Mixing 2-space and 4-space indentation within the same list breaks rendering on some processors. Pick one indentation size and stick with it throughout the document.

FAQ

How do I indent text in Markdown?

Markdown has no general-purpose indent command. Use nested lists (2–4 spaces before the marker) for structured content, blockquotes (>) for visual indentation with a border, or &nbsp; entities for a plain text indent. The right method depends on what kind of indentation you need.

How many spaces to indent in Markdown?

For nested lists: 2 spaces on GitHub/CommonMark, 4 spaces in classic Markdown. For code blocks: exactly 4 spaces or 1 tab. If nesting does not render, try increasing from 2 to 4 spaces.

Can I indent a paragraph in Markdown?

Not with spaces — Markdown strips leading whitespace from paragraphs. Use &nbsp; entities for a visual indent, a blockquote for a bordered indent, or HTML with margin-left for custom spacing (note: GitHub strips CSS styles).

Preview Your Markdown with MDViewer

MDViewer is a native macOS app that renders Markdown with full support for nested lists, blockquotes, code blocks, and HTML indentation. Open any .md file from Finder and see exactly how indentation will look. Lite is free; Pro adds editing, Git history, and PDF export.

Download MDViewer

Requires macOS 13.0 or later. Intel and Apple Silicon.