Toolstia / Tab to space converter
Tab to space converter
Switch the indentation of your text or code between tabs and spaces. Choose how many spaces make a tab. Tabs are converted to the next tab stop, so columns stay lined up.
How it works
- Choose tabs to spaces or spaces to tabs.
- Set the number of spaces per tab.
- Paste the text and copy the converted result.
Tabs to spaces
Each tab is replaced by enough spaces to reach the next tab stop, so a tab in the middle of a line keeps its alignment.
Spaces to tabs
Leading spaces are grouped into tabs. Spaces left over stay as spaces. An option also converts long runs of spaces inside lines.
Why it matters
Makefiles and some other formats need real tabs, while many style guides ask for spaces.
Change count
The tool reports how many changes it made so you can see at a glance if anything happened.
Questions
Will it change my code?
Only whitespace changes, never other characters. Everything happens in your browser, and nothing you enter is sent anywhere.
Which tab size should I choose?
Use the size your editor or style guide uses, usually 2, 4 or 8.
Does it handle Windows line endings?
Yes. Line endings are left as they are.