Markdown Indent: The Complete Guide to Text Indentation, Nested Lists, and More

Markdown doesn't have a dedicated "indent" syntax. That's by design — when John Gruber created Markdown, he left layout and formatting to CSS, keeping Markdown focused purely on content structure. But in practice, you'll often run into situations where you need indentation: technical docs, blog posts, READMEs. And if you're working with CJK (Chinese, Japanese, Korean) text, first-line indentation is practically mandatory.

This article covers every indentation scenario and method in Markdown. Whether you're building nested lists on GitHub or setting up paragraph indentation for a blog, you'll find the right approach here.

Understanding Markdown's Indentation Rules

Before diving into specific methods, it helps to understand how Markdown handles indentation under the hood. When the Markdown parser sees spaces or tabs at the beginning of a line, it decides what to do based on the count:

Leading spaces/tabsMarkdown interprets it asResult
0Regular paragraph textNormal display
1-3 spacesRegular paragraph text (spaces ignored)No visible indent
4 spaces or 1 tabCode blockMonospace font display
2-4 spaces before a list itemNested list itemSub-list
> characterBlockquoteLeft border line

These rules come from the CommonMark spec and Gruber's original documentation. So if you just type spaces in front of a paragraph, chances are you won't see any indentation — the parser simply ignores them.

Method 1: HTML Space Entities (Most Common)

This is the most widely used approach. You insert HTML space entity characters directly into your Markdown. Parsers don't ignore HTML entities, so the indentation takes effect.

HTML Space Entities Reference

EntityNameWidthBest for
 Non-breaking space~1 character widthEnglish text, fine-tuning spacing
 En space~0.5 em widthLess commonly used
 Em space~1 em widthParagraph first-line indent
 Thin space~0.2 character widthSubtle spacing adjustments

First-line Indentation

For CJK text where you need to indent by two characters at the start of each paragraph, two   entities do the trick:

  This is a paragraph with a first-line indent equivalent to two characters. This method works correctly in GitHub, Typora, and VS Code preview.

  Just add these two entities at the beginning of each paragraph. It's a bit tedious, but has the best compatibility.

English Text Indentation

For English text, 4   or 2   entities typically work well:

    This paragraph has an indent at the beginning. It works across most Markdown renderers.

Honestly, the biggest downside of this method is the tedious manual typing. But if you're using Typora or VS Code, you can set up a code snippet to speed things up. I once wrote a long article where every paragraph needed    at the start, and it was painful until I set up a VS Code snippet — type ;2em and it auto-expands. Huge time saver.

Method 2: Fullwidth Space (CJK Typography Trick)

This is a trick that most English tutorials won't mention, but for CJK users it might be the simplest approach.

How to do it: Switch your input method to fullwidth mode, then type two spaces.

  This text is preceded by two fullwidth spaces (U+3000), which visually creates a first-line indent equivalent to two characters.

Fullwidth spaces (Unicode U+3000) aren't ignored by most Markdown renderers, so they produce visible indentation. Compared to   entities, fullwidth spaces look more intuitive in the source code.

There's a catch though: some editors' auto-formatters will replace fullwidth spaces with regular spaces, killing the indentation. If you notice your indents disappearing, check your editor's formatting settings. I once ran Prettier on a Markdown file and watched all my fullwidth spaces vanish. After that, I stopped using this approach in any project with Prettier configured.

Method 3: Blockquote for Visual Indentation

If your goal isn't first-line indentation but rather shifting an entire block of text to the right — like quoting someone else's words or highlighting a paragraph — blockquotes are the way to go:

> This text will be indented to the right with a vertical line on the left.
> You can write multiple lines, and the visual effect is equivalent to overall indentation.
>
> You can even create separate paragraphs by adding `>` on a blank line.

Blockquotes can be nested for multiple levels of indentation:

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

Strictly speaking, blockquotes aren't an "indentation syntax," but they're a natively supported Markdown feature that works across all renderers. Semantically, they represent "quoted content," making them ideal for citing other people's work.

Method 4: HTML Tags for Precise Control

When you need to control the exact indentation distance or indent an entire block of text (not just the first line), use HTML div or p tags with margin-left styling:

<div style="margin-left: 2em;">
This entire block is indented 2em to the right.
Useful when you need large-area indentation.
</div>

Or with padding-left:

<p style="padding-left: 40px;">
This paragraph has 40px of left padding.
You can control indentation down to the pixel.
</p>

Note: This method depends on the Markdown renderer supporting HTML tags and inline styles. GitHub and most static site generators (Jekyll, Hugo, Hexo) support it, but some platforms (like certain forums and Discord) strip HTML tags entirely.

Method 5: Nested List Indentation

Nested lists are the one indentation scenario where Markdown has the most "official" support. Add 2-4 spaces before a list item to create a sub-list:

- First item
  - Nested sub-item (2 spaces)
    - Deeper nesting (4 spaces)
- Second item
  - Sub-item
    - Deep sub-item
      - Even deeper

You can mix ordered and unordered lists:

1. Installation steps
   - Download the installer
   - Run the setup wizard
2. Configuration steps
   1. Open the config file
   2. Change the port number
      - Default port: 8080
      - Custom port range: 1024-65535

A common question about list indentation: should you use 2 spaces or 4?

The CommonMark spec defines it this way: continuation content of a list item must be indented to the column where the text after the list marker begins. For unordered lists (-), the marker takes 2 characters, so indenting 2 spaces is sufficient. For ordered lists (1.), the marker takes 3 characters, so sub-items need 3 spaces.

In practice, most renderers handle 2-4 spaces correctly. But if you notice nested lists rendering oddly on GitHub, try adjusting the space count.

Method 6: CSS Global Indentation (Set It and Forget It)

If you run your own blog or website, CSS is the most elegant solution for first-line indentation. Set it once and every paragraph gets indented automatically — no manual markup needed:

/* First-line indent for all paragraphs */
p {
  text-indent: 2em;
}

/* Prevent images from being indented too */
p img {
  margin-left: -2em;
}

This works with Jekyll, Hugo, Hexo, and WordPress. It won't work on GitHub READMEs or platforms where you can't control the CSS.

One thing to watch out for: after switching to CSS-based indentation, remember to clean up any manual &emsp; or fullwidth spaces in older articles, or you'll get double indentation. I once helped a friend migrate from WordPress to Hugo — every article had manual &emsp;&emsp; at the start of paragraphs, and after switching to the CSS approach, everything got "double indented." Ended up writing a script to batch-clean them all.

Which Method Should You Use?

ScenarioRecommended methodWhy
Nested lists in GitHub READMEList indentation (2-4 spaces)Native support, no hacks needed
Paragraph indent in GitHub README&emsp; or &nbsp;GitHub supports entities but strips some HTML
Writing blog posts in TyporaFullwidth space or &emsp;Intuitive, good compatibility
Self-hosted blog/websiteCSS text-indentSet once, works everywhere; content/style separation
Pixel-precise indentation controlHTML margin-leftPixel-level accuracy
Quoting someone else's contentBlockquote >Semantically correct, native support
Pandoc / R MarkdownLine block \| syntaxNatively preserves leading spaces

Renderer Compatibility Reference

Different platforms support indentation methods to varying degrees. Here's a comparison table:

MethodGitHubTyporaVS CodeObsidianJekyll/Hugo
&nbsp; / &emsp;
Fullwidth space
Blockquote >
HTML margin-left⚠️ Partially stripped⚠️ Limited
CSS text-indent
Pandoc line block \|⚠️ Requires Pandoc

"⚠️ Partially stripped" means GitHub preserves some HTML tags but strips certain style attribute values. Actual results may vary — test before relying on it.

About the Tab Key

Pressing Tab in a Markdown editor behaves differently depending on the editor:

  • Typora: In lists, Tab indents the current item; in regular paragraphs, Tab might insert 4 spaces or move focus
  • VS Code: Inserts 4 spaces by default (configurable to 2); in lists, Tab indents
  • Obsidian: Tab indents in lists; does nothing in regular text
  • GitHub web editor: Tab is mainly used for list indentation

Bottom line: the Tab key in Markdown editors is primarily for list indentation. It's not suitable for paragraph first-line indentation.

FAQ

Why don't spaces at the start of a paragraph work?

The Markdown spec treats 1-3 leading spaces as insignificant — they get ignored. Four or more spaces turn the content into a code block. So typing regular spaces for paragraph indentation simply won't work.

What's the difference between &emsp; and &nbsp;?

&emsp; has a width equal to one em (roughly one character width at the current font size), while &nbsp; is approximately one regular space width. For CJK first-line indentation, &emsp; is more precise — two &emsp; entities equal the width of two CJK characters.

Can I use HTML styles for indentation on GitHub?

GitHub's Markdown renderer (GFM) supports some HTML tags but strips style attributes. So <div style="margin-left: 2em;"> likely won't work on GitHub. Stick with &emsp; entities or blockquotes on GitHub.

How do I quickly type &emsp; in VS Code?

Add a custom snippet in VS Code. Open the command palette, search for "Configure User Snippets," select markdown.json, and add:

{
  "Indent shortcut": {
    "prefix": ";2em",
    "body": ["&emsp;&emsp;$0"],
    "description": "Insert paragraph indent"
  }
}

Now type ;2em and press Tab in a Markdown file to insert the indent quickly.


Markdown indentation isn't a huge topic, but it's one of those things with more nuance than you'd expect. There's no native syntax for it, but between HTML entities, fullwidth spaces, blockquotes, HTML tags, and CSS, you can cover pretty much every indentation need. Which method to pick depends on your platform and use case — for GitHub READMEs, &emsp; and list indentation get the job done; for your own blog, go straight to CSS text-indent.

Sources