Advertisement

Indentation Converter

Fix mixed indentation with the Indentation Converter. Convert tabs to spaces or spaces to tabs at any width, instantly in your browser.

Convert indentation

Paste code. Only leading indentation is changed. Updates live.

Paste code above to begin.
Advertisement

How conversion works

Each line's leading whitespace is rewritten: tabs expand to the chosen number of spaces, or groups of spaces collapse into tabs. Content after the indentation is never touched, so strings and alignment inside the line survive.

Mixed indentation

Lines that mix tabs and spaces are counted for you. In highlight-only mode nothing is rewritten; you just learn where the mixing happens before deciding how to fix it in your editor.

Indentation Converter FAQs

Will it change indentation inside strings?
No. Only whitespace at the very start of a line is converted.
Which width should I pick?
Match your project: 2 for most JavaScript, 4 for Python and Java. Converting with the wrong width still works but shifts nesting visually.
Spaces to tabs with odd space counts?
Leftover spaces that do not fill a full tab are kept as spaces, so alignment stays as close as possible.
Does it sort or format my code?
No. It only rewrites leading indentation; logic and line order are untouched.
Is my code uploaded?
No. Everything runs locally in your browser.
Advertisement