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.
Practical Checklist
Start with the right input
Bring the draft, note, transcript, or block of text that matches this use case. For indent code for readme files & documentation, a focused source gives Text Indentation a clearer job and makes the result easier to review.
Use the result in context
Scan the results for wording, structure, formatting, and readability issues, then match the output to the final destination before exporting or copying it.
Move it into your workflow
Once the output is ready, copy, export, or reuse the cleaned text in your document, CMS, or workflow. Keep the original source nearby so you can rerun the tool if requirements change.
Frequently Asked Questions
Related Tools
Compare two versions of any code file side by side with syntax highlighting for 50+ languages. Changed lines are highlighted in green and red — like a lightweight code review tool.
Paste formatted text from Word, Google Docs, or Outlook and instantly see the clean HTML code behind it. Useful for publishing content to a CMS, email template, or webpage.
Paste two versions of any text and instantly see every change highlighted, character by character. Perfect for proofreading, comparing drafts, and spotting edits between two documents.
More Ways to Use Text Indentation
Looking for the full-featured tool?
View Text Indentation