Skip to content
Toolcroft

Text Tools

Text Indenter / Dedenter - Add or Remove Indentation

Add or remove indentation from every line of text. Choose spaces or tabs and set the indentation amount.

Add or remove indentation in bulk

Paste any block of text and choose whether to indent (add) or dedent (remove) indentation from every line. You can select spaces or tabs and choose how many characters to add or remove per operation.

Common use cases

  • Increasing the indentation level of a code block when nesting it inside a function.
  • Removing leading spaces from text pasted from a document or email.
  • Converting tab-indented code snippets before pasting into a space-only codebase.

How dedent works

When dedenting, up to the specified number of leading spaces (or tabs) are removed from each line. Lines with fewer leading characters than the requested amount are dedented as far as possible without error. Empty lines are left unchanged.

Tabs vs. spaces

The tabs-versus-spaces debate is one of the most persistent in software development. Here is how major ecosystems handle it:

  • Python: either tabs or spaces are valid, but they must be consistent within a file. PEP 8 recommends 4 spaces.
  • Go: tabs are mandated by gofmt, the official formatter.
  • JavaScript / TypeScript: conventionally 2 spaces (Prettier default; Airbnb style guide).
  • Ruby: 2 spaces (community standard).
  • Java / C#: 4 spaces (both language style guides).

Use the space/tab toggle to match whichever convention your project requires.

Removing markdown code block indentation

A very common use case for this tool: when you copy code from a Markdown code block (indented with 4 spaces to trigger code formatting), you need to strip those 4 leading spaces before pasting into an IDE. Paste the indented block here, set dedent to 4 spaces, and click Remove Indentation. The result is clean, unindented code ready to paste anywhere.