About Tabs to Spaces
Tabs to Spaces replaces tab characters with runs of spaces. Paste text that uses tabs for indentation, choose how wide a tab should be, and the output comes back with every tab expanded and nothing else touched. It is the usual fix for code, data or configuration that has to use spaces because tabs are rendered at different widths in different editors.
The replacement is a plain substitution across the whole text, so a tab anywhere in a line is expanded, not only the ones used at the start of a line. The width comes from the number box, which allows one to eight spaces and opens on four, the most common convention for source files and configuration.
One detail trips people up: each tab becomes a fixed number of spaces rather than advancing to the next tab stop. An editor moves a tab forward to the next multiple of the tab width so columns line up, whereas here every tab is the same width wherever it sits. For a file where tabs were only ever used to indent whole lines the two behave alike, but text that mixes tabs and spaces part-way through a line will not line up exactly as it did before.
How to use Tabs to Spaces
- 1 Paste the text containing tabs into the input box.
- 2 Set how many spaces a tab should become, with four as the default.
- 3 Press the button to see the expanded text.
- 4 Copy the result, which no longer contains any tab characters.
Frequently asked questions
Will the columns still line up afterwards?
Not always. Each tab becomes the same number of spaces wherever it sits, while an editor advances a tab to the next tab stop. Lines indented only with tabs come out even; lines that mix tabs and spaces part-way through may shift.
Can I set a tab width of zero?
No. The number box accepts one to eight, and the calculation never uses a value below one, so a width of zero spaces per tab cannot be produced.
Are tabs in the middle of a line converted too?
Yes. The substitution runs over the entire text rather than only at the start of lines, so a tab used to align a column part-way through a row is expanded along with everything else.
Is anything else in my text changed?
No. Spacing, line breaks, leading whitespace and trailing whitespace are all left as they were. The only change is that each tab character becomes a run of spaces, so nothing is trimmed or re-wrapped.
Free, online, and private
Free to use
Tabs to Spaces is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How Tabs to Spaces behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Replaces | every tab character in the text, wherever it appears on the line, not only the leading ones |
| Spaces per tab | 4 by default, adjustable in the field between 1 and 8 |
| Clamping | the value is floored at 1 inside the run function as well as in the field definition |
| Input | a text area, defaulting to three single characters separated by two tab characters |
| Output | plain text with no tab characters left in it; nothing else about the string is altered |
Compiled from the implementation of this tool and checked against it by itoolnet.
What Tabs to Spaces does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- Tabs are expanded to a fixed count, not to the next tab stop. A real editor advances a tab to the next multiple of the tab width so indentation lines up in columns; here every tab becomes exactly the same number of spaces no matter where it sits in the line, so a block that mixes tabs and spaces will not line up the way it does in the editor it came from.
- Only the literal tab character is touched. Runs of spaces are left exactly as they are, so this is not a re-indenter - to convert spaces back into tabs you need the Spaces to Tabs tool, and to normalise mixed indentation you have to pick one direction and accept that the other kind passes through untouched.
- Nothing is trimmed, re-indented or wrapped. Leading tabs are expanded like any other, so indentation grows by the same count, trailing whitespace at the end of a line survives untouched, and empty lines stay empty - the only change the tool is capable of making is turning one character into several.
Tested and documented by itoolnet, the team that builds and maintains this site.