Free Online Tabs to Spaces and Spaces to Tabs Converter
Change the indentation of code or text both ways. Tabs become spaces using real tab stops rather than a flat multiply, spaces become tabs at the width you set, and only the indentation is touched unless you ask for the whole line. Mixed indentation is reported.
Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.
How to Use Tabs and Spaces Converter
Step by step, start to finish.
Drop a file on the box if it is long. Nothing is uploaded, so unreleased code is safe here.
Tabs to spaces or spaces to tabs, and the width your project uses. Two for JavaScript and Ruby, four for most things, eight for Go and old C.
Leave "only the indentation" on for code and for data in columns. Turn it off only when you really want every tab in the line converted.
If lines mixed tabs and spaces, the note says how many. Those are the lines that look fine in your editor and wrong in everyone else's.
Key Features
What this tool does, and what it does not do.
Tabs expand to the next stop and spaces collapse back at the stop, the way editors and terminals actually behave.
One tool, one switch. No hunting for the opposite page when the project changes its mind.
The default touches the start of the line and nothing else, so tab separated data survives.
Lines that started with both tabs and spaces are counted, which is usually the bug you came here for.
An optional pass that removes the spaces at the end of lines, the ones that show up in every diff.
Source code goes in and stays in your browser. There is no server in the middle to receive it.
About Tabs and Spaces Converter
Tabs against spaces is an old argument, and this page takes no side in it. What it does is make moving between the two exact. Swapping every tab for a fixed number of spaces is only right for a tab at the start of a line; a tab in the middle of a line jumps to the next tab stop, and this converter follows those stops so text stays in its column.
The second thing it protects is data. A great deal of text is tab separated, and a line of it can look like an indented line. Converting the tabs inside it would merge the columns into ordinary spaces, so by default this page only touches the whitespace at the start of a line and leaves tab separated values intact.
The count of mixed lines is the part that earns its keep. Indentation that mixes tabs and spaces renders differently in every editor, so the file looks neat to the person who wrote it and broken to everyone else. Seeing that eleven lines are mixed, before converting anything, usually explains the argument the team has been having about the file.
Frequently Asked Questions
Common questions about this tool.
More Text Tools
Other tools from the same hub, free and in your browser.
Feedback
No feedback on this tool yet. Yours would be the first.