Indent Code for README Files & Documentation
Paste code and add consistent indentation — tabs or spaces, any depth. Perfect for nesting code inside Markdown, README files, and technical documentation.
When embedding code snippets in documentation, README files, or Markdown documents, the indentation needs to be correct. Code inside a Markdown list item needs an extra level of indentation. Code inside nested elements needs two or more levels. Getting the whitespace wrong breaks the Markdown rendering.
This tool lets you paste any code snippet and add a specified number of tabs or spaces to every line. The result is correctly indented code ready to paste into your documentation.
Features
Tabs or Spaces
Choose between tabs and spaces, and set the exact number of spaces per level — 2, 4, or any custom value.
Multi-Level Indent
Add one or multiple levels of indentation to properly nest code in complex Markdown structures.
Real-Time Preview
See the indented result update as you change settings. Copy when it looks right.
How It Works
Copy a code snippet, function, or example and paste it into the tool.
Select tabs or spaces and set how many levels of indentation to add.
The indented code is ready to paste into your README, doc, or Markdown file.
Getting Indentation Right in Documentation
Markdown is whitespace-sensitive. A code block inside a list item requires 4 spaces (or 1 tab) of indentation to render correctly as code within that list item. A code block inside a nested list item requires 8 spaces. Getting this wrong means the code renders as plain text or breaks the list structure.
This problem is especially common in README files, where code examples are frequently nested inside structured content. API documentation, installation instructions, and usage examples often include code within lists, tables, or nested sections.
The tool is also useful for general code reformatting — adjusting the indentation level of a pasted snippet to match the indentation style of the surrounding code. If you are contributing to a project that uses 2-space indentation and your snippet uses 4 spaces, a quick re-indent fixes the mismatch.
Frequently Asked Questions
More Ways to Use Text Indentation
Looking for the full-featured tool?
View Text Indentation