Convert tab characters to spaces for consistent indentation across all editors and platforms. Set tab width (2, 4, or 8 spaces), convert only leading indentation or all tabs, and preview a live diff showing exactly what changed.
Paste code, config files, or any text that uses tab characters for indentation. The tab count and affected line count are displayed immediately so you can see the scope of the conversion before processing.
Choose 2 spaces (modern JavaScript, TypeScript, Ruby), 4 spaces (Python PEP 8, PHP, Java), or 8 spaces (traditional Unix, C legacy). You can also type a custom value. The output updates instantly as you change the setting.
The live diff view highlights every changed line — original (with tab markers ¬) shown in red, converted (with space dots ·) shown in green. Copy or download the converted text when satisfied.
Tabs render at different widths depending on the editor, terminal, or viewer. Your IDE may show a tab as 4 spaces wide, GitHub renders it as 8, a terminal may use 4 or 8 depending on system settings. Spaces are always exactly one character wide everywhere, guaranteeing consistent visual alignment across all tools, platforms, and collaborators.
Follow your project or language convention. Python (PEP 8) requires 4 spaces. Modern JavaScript and TypeScript typically use 2 spaces (enforced by Prettier). Ruby uses 2 spaces. Java and PHP commonly use 4. Traditional C and Unix code used 8-space tabs. When in doubt, 4 spaces is the most widely compatible choice.
Leading tabs only converts only the tab characters at the start of each line — the indentation. Tabs within the line content are left untouched. This is the correct mode for reformatting code. All tabs converts every tab character in the entire text, including those within content — useful for converting TSV data to space-separated format.
No — if you convert consistently with the correct number of spaces, Python code remains valid. Python 3 requires consistent indentation within a block but does not care whether you use spaces or tabs as long as you do not mix them. The tool converts all tabs to spaces throughout the file, eliminating the mixed-indentation problem.
If you use leading tabs only mode, tabs used for alignment within lines are left unchanged. If you use all tabs mode, those alignment tabs will be converted to a fixed number of spaces, which may break the visual alignment. For column alignment inside lines, consider a code formatter that understands your language semantics.
Most IDEs have built-in tab-to-space conversion. In VS Code, open the Command Palette and run Convert Indentation to Spaces. This tool is useful when you cannot open the code in an IDE, when working with plain text files, or when you want a visual diff to verify exactly what changed before committing.