Indent Converter
Normalize the leading whitespace on each line. Tabs advance to the next tab stop from the current column rather than being blindly replaced with a fixed number of spaces.
Key features
- Calculate indentation columns using tab stops, including mixed prefixes.
- Output all spaces or full tabs with any remaining spaces.
- Preserve content and whitespace after the indentation prefix.
How to use
- Paste the indented text or code.
- Select the direction and a tab width from 1 to 16.
- Run and compare the result using the same tab width in your editor.
Use cases
- Normalize mixed indentation in pasted code
- Turn leading tabs into spaces for a document
- Preserve alignment for lists with a known tab width
Frequently asked questions
What happens to a space followed by a tab?
At width 4, the tab advances from column 1 to column 4, producing four spaces in total rather than five.
Does this format code by its syntax?
No. It preserves existing indentation columns without parsing syntax. It is not a code formatter or Python validator.
Are tabs inside strings converted?
Only the initial continuous run of spaces and tabs on a line is changed. Everything after the first other character is preserved.
Why does the result look different in my editor?
Check that the editor uses the same tab width. Line endings are normalized to LF, and a final newline is preserved.
Privacy
Input and results are processed in your browser. This tool does not send or save their contents to a server. Shared site advertising, visitor analytics, and aggregate tool-use measurement may operate separately.
Comments & questions