Skip to content
TextArray
100% local

Indent text

Add or remove indentation at the start of every line, with spaces or tabs.

Input
Output

Indent text

Indent text adds or removes leading whitespace on every line at once. Paste a block of code, a list or a quote, choose spaces or tabs and how many per line, and the tool re-indents the whole thing instantly. It is the quick way to shift a snippet into place inside a larger file, indent a blockquote, or line up a plain-text outline without touching each row by hand.

Three actions cover the usual needs. "Add indentation" prefixes each line with the chosen number of spaces or tabs. "Remove indentation" strips up to that many units from the start of each line, and it is forgiving: a line with fewer leading spaces than the count simply loses what it has, so nothing shifts out of alignment. In spaces mode a leading tab is left alone, and in tabs mode leading spaces are left alone, so you never mix the two by accident.

"Remove common indentation" works like a code dedent: it finds the whitespace that every non-empty line shares and removes exactly that much from all of them, so a snippet copied out of a deeply nested function drops back to the left margin while its internal structure stays intact. This one ignores the amount and unit settings, because the shared margin defines how much to cut.

The "Leave empty lines untouched" option keeps blank and whitespace-only lines as they are, so adding indentation never sprinkles trailing spaces onto empty lines. Line endings are normalised, so mixed CRLF and LF input comes out consistent. Everything runs locally in your browser and nothing is uploaded.

FAQ

What is the difference between remove and remove common indentation?
"Remove indentation" strips a fixed number of units from every line. "Remove common indentation" measures the whitespace all non-empty lines share and removes exactly that, like a code dedent, keeping the relative structure.
What happens if a line has less indentation than the amount I set?
It simply loses the whitespace it has and nothing more. Removing four spaces from a line that starts with two just removes those two, so lines never shift out of alignment.
Does removing spaces affect tabs?
No. In spaces mode a leading tab stops the removal and is left in place, and in tabs mode leading spaces are left alone. This keeps you from mixing the two indentation styles by accident.
What does "Leave empty lines untouched" do?
It skips blank and whitespace-only lines, so adding indentation never adds trailing spaces to empty lines and removing it leaves them as they were.
Is my text uploaded anywhere?
No. The text is processed entirely in your browser and never leaves your device.