Two strip modes, one for surgical removal
Mode is the core control. Remove All (the default) runs line.replace(/^\s+/, '') on every line, which strips every leading whitespace character (space, tab, vertical tab, form feed, and Unicode whitespace). It is the easiest way to flatten arbitrary indentation back to column zero.
Remove N Levels is precise: it strips the Symbols string from the start of each line, up to Levels times. The default Symbols is (four spaces) and the default Levels is 1. So with the defaults a line starting with eight spaces becomes four spaces, a line starting with four spaces becomes empty, a line starting with three spaces is unchanged.
The strip is anchored to the start: line.indexOf(sym) === 0. If a line's leading run does not exactly match Symbols, the loop stops for that line. This means you can preserve mixed indentation safely (only the lines that actually start with your symbol get stripped). Set Symbols to \t for tab-only indents.
How to use unindent every line
- 1Paste your text into the input panel on the left.
- 2Pick a Mode:
Remove Allfor any leading whitespace,Remove N Levelsfor a specific symbol. - 3In
Remove N Levelsmode, set Symbols to the indent unit (default four spaces). - 4Set Levels to the number of times to strip the symbol (1 to 40).
- 5Click Copy or Download in the output header.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
Remove All uses /^\s+/
Default mode. Every leading whitespace character is removed: spaces, tabs, vertical tabs, form feeds, Unicode whitespace. The line is left starting with its first non-whitespace character.
Remove N Levels matches your indent symbol
The strip is line.indexOf(sym) === 0 in a loop, up to Levels times. Symbols defaults to four spaces; set it to \t for tabs, (two spaces) for two-space code, or any custom marker.
Empty Symbols is a no-op
If Symbols is empty in Remove N Levels mode the input is returned unchanged. The strip needs a non-empty target.
Mismatched leading whitespace is preserved
In Remove N Levels mode the loop only strips when the line exactly starts with Symbols. So if your file mixes tab-indented and space-indented lines, only the matching ones are touched.
Reverse with the indent tool
Indent text is the natural inverse. Pair the same Length and Indent With there with Symbols here for a clean round trip.
Worked example
Mode Remove N Levels, Symbols four spaces, Levels 1. Each line loses one four-space level of indent.
function greet() {
console.log('hi');
}
function greet() {
console.log('hi');
}
Settings reference
| Behaviour | Effect on output |
|---|---|
Mode = Remove All |
Strips every leading whitespace character via /^\s+/. Levels and Symbols are ignored. |
Mode = Remove N Levels |
Strips Symbols from the start of each line up to Levels times. |
| Symbols populated | The exact string used as one indent step. |
| Symbols empty | Input passes through unchanged in Remove N Levels mode. |
| Levels (1-40) | Maximum strip count per line. The loop stops as soon as the leading text no longer matches. |
| Mismatched indent | Lines whose leading run does not start with Symbols are left untouched in Remove N Levels mode. |
| Line endings | CRLF input becomes LF output. |
FAQ
How do I remove tab indentation?
Remove N Levels mode with Symbols set to a single tab character. Set Levels to the number of tab levels to strip.What is the difference between the two modes?
Remove All strips every leading whitespace character regardless of structure, flattening lines to column zero. Remove N Levels only strips when the leading text exactly matches your Symbols, preserving partial indents and mixed cases.