What Tabs to Spaces helps you do
Expand tab characters into a chosen number of spaces. This settles the classic tabs-versus-spaces debate for a specific file by converting indentation into spaces without changing how the code lines up. Tabs inside a line are expanded too, using tab stops rather than a blanket replacement.
Tab expansion runs entirely in your browser. Your text stays on your device.
How it works
Each cleanup tool applies one deterministic string transformation to the pasted text inside the page. There is no parser, model or server call: the same input and options produce the same output every time. The browser holds the text in memory, so the result updates as you edit and is not retained after the tab closes. Because the transformation is literal, non-breaking spaces, mixed line endings and tabs may behave differently from a word processor; compare a short sample before applying it to a large file. The page never rewrites the source on disk, so the only undo is your own copy.
How to use Tabs to Spaces
- Paste text that contains tab characters.
- Set the tab size your editor uses, commonly 2 or 4.
- Convert the tabs and check the alignment in a monospace view.
- Copy the space-indented result.
When to use it
- Convert tab-indented code before committing to a space-indented repository.
- Paste tab-separated data as fixed spaces for a report.
- Match a file to a linter that forbids tabs.
- Make indentation visible in a plain-text editor.
- Prepare a code sample for a medium that renders tabs unpredictably.
- Compare two snippets after normalizing their indentation.
When not to use it
- Do not use it on TSV data where the tabs are field separators; convert the data with a CSV tool instead.
- Do not use it if the destination expects hard tabs.
- Do not assume the tab size; check the source editor first.
Example
A line indented with one tab becomes indented with four spaces when the tab size is set to four. A tab after two characters advances to the next tab stop, so the following text lines up with the column the editor used. The conversion changes the characters, not the visual alignment.
What you can do with Tabs to Spaces
- Expand every tab into spaces at 1–16 spaces per tab.
- Use tab-stop positions so columns stay aligned.
- Convert leading and internal tabs.
- Match the tab width used by the source editor.
- Copy the space-indented result.
- Run the conversion locally with no upload.
Example: verify the cleanup on a sample
Paste a short, representative sample first rather than the whole file. Check the edges: leading and trailing spaces, blank lines, tabs and any non-breaking spaces the source may contain.
Apply the transformation and compare the sample with the original. If the change is correct, run the full text; if not, adjust the source or choose a different cleanup tool.
Copy or download the result and keep the original until the destination import succeeds. Most of these tools are one-way, so the source file is the only reliable undo.
If the text came from a PDF, a spreadsheet or a CMS, look for invisible characters before blaming the cleanup. A no-break space or a soft hyphen can survive the pass and still break a comparison downstream.
Run the cleaned text through the destination's preview or import step before deleting anything. A formatting change that looks right in the textarea can still fail a strict parser.
What to know before you start
- Tabs inside the line, not just at the start, are also expanded, which can shift columns.
- The result depends entirely on the tab size matching the original editor, or alignment changes.
- It cannot know whether a tab was indentation or a field separator.
- The output uses ASCII spaces, which can make the file larger.
Common mistakes
- Using the wrong tab size and shifting every column.
- Converting TSV field separators into spaces and losing the columns.
- Expecting the result to stay tab-indented.
- Ignoring tabs that appear after text on a line.
- Committing the converted file without checking the diff.
Troubleshooting
If alignment changes, the tab size does not match the source editor; restore the original and try the other common size.
If columns are lost, the file used tabs as data separators; use a CSV/TSV tool instead.
If a tab remains, it may be a different whitespace character; inspect it in a hex or whitespace view.
If the diff is huge, that is expected: every indented line changed.
Related standards and documentation
- Unicode whitespace includes characters such as the no-break space that may not look like a space.
- Line endings may be CRLF, LF or CR before cleanup; normalize them first when the target requires one style.
- The tools operate on Unicode text, not on bytes in a legacy encoding.
- Compare a short sample first.
- Watch for non-breaking spaces and tabs.
- Keep the original until the import works.