Convert Tabs to Spaces
Swap tab characters for spaces, or spaces back to tabs, at any indent width.
Runs entirely in your browser.
Convert Between Tabs and Spaces
About Convert Tabs to Spaces
Each tab becomes the number of spaces you choose, or each group of that many spaces becomes one tab. The default is four, which matches most style guides; Python's PEP 8 uses four spaces, and Go uses tabs.
Only leading whitespace is converted by default, because that is what indentation means. Spaces inside a line are usually deliberate - aligned comments, text in a string - and turning those into tabs would break them. Untick Indentation only if you really want the whole line converted.
Other Whitespace Tools
- Whitespace Cleaner — every option on one page
- Remove Extra Spaces — collapse runs of spaces
- Remove Blank Lines — delete empty lines
- Sort Lines — sort, with an option to trim whitespace