Indent / Dedent Text
Prefix each line with a chosen number of spaces or tabs, or strip up to that much leading indentation back off. Blank lines can be left untouched.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
Shifting a block left or right
In indent mode every line is prefixed with the chosen number of spaces or tabs, which is what you want when pasting a snippet into a nested block. Dedent is the reverse: it strips up to the chosen amount of the same leading unit from the start of each line, so a block copied out of a function can be lifted back to column zero.
Spaces or tabs
The unit selector decides the character that is added or removed. With spaces, the count is how many space characters prefix the level; with tabs, one unit is a single tab character and the count is how many tabs. Dedent only removes the selected unit, so a file that mixes both will stop at the first character that does not match.
Blank lines can be skipped
With the blank-line option on, empty or whitespace-only lines are left exactly as they are instead of gaining trailing indentation, which keeps diffs clean. Turn it off when you need strictly uniform leading whitespace on every line, including the empty ones.
Runs as you type
The transformation is a line-by-line string operation performed in this tab. Nothing is uploaded, no request is made, and there is no saved state, so pasting private source or configuration here exposes it to nobody but you.
Questions
What does dedent do if a line has less indentation than requested?
It removes whatever leading indentation is there, up to the requested amount, and leaves the rest of the line alone. It never removes non-whitespace characters.
Does dedent mix spaces and tabs?
No. It removes only the selected unit from the start of each line, stopping at the first character that is not that unit.
How are blank lines handled?
By default blank lines are left untouched in both modes. Turn "Leave blank lines untouched" off to indent or dedent them like any other line.
Related tools
See categoryWrap / Unwrap Text
Hard-wrap text to a fixed column width with greedy word wrap, or unwrap wrapped lines back into paragraphs.
Repeat Text
Repeat the input a set number of times, joined by a newline, space, comma, or custom separator.
Case Converter
Convert between UPPER, lower, Title, Sentence, camelCase, snake_case, kebab-case and more.
Remove Duplicate Lines
Delete repeated lines from a list, keeping the first or last occurrence.