Tabs to Spaces

Convert tab indentation to spaces — replaces every tab with 4 spaces instantly for consistent code style. Free, client-side untabify converter.

🔒 100% Client-Side Processing

Your data is processed entirely in your browser and never transmitted to any server.

0 / 100M Limit

Common Use Cases

Fixing Python indentation errors

Convert tab-indented code to spaces to satisfy PEP 8 and eliminate the mixed-indentation TabError.

Making diffs render consistently

Untabify code so alignment looks identical in review tools, terminals, and editors regardless of tab-width settings.

Preparing YAML content

YAML forbids tabs in indentation — convert pasted content before it breaks parsing.

Frequently Asked Questions

How many spaces replace each tab?
Each tab character becomes exactly 4 spaces. This "untabify" step makes indentation render identically in every editor, terminal, and diff view regardless of tab-width settings.
Why do style guides prefer spaces?
Consistency: spaces render the same width everywhere, keeping alignment intact in code review tools and terminals. Python's PEP 8 mandates 4-space indentation, and mixed tabs-and-spaces is a syntax error in Python 3.
Will this change tabs inside my strings and comments?
Yes. The replacement is textual and has no understanding of syntax, so a tab inside a string literal, a comment or a here-doc is expanded exactly like an indentation tab. For source files where that matters, use your editor's or formatter's conversion, which parses the language first.
Does it affect tabs in the middle of a line?
It does — every tab becomes four spaces, wherever it appears. That matters for tab-separated data, where converting alignment tabs will silently destroy the column structure. Convert indentation in code, not delimiters in data.
How do I convert back to tabs?
The Spaces to Tabs tool reverses it, collapsing each run of four spaces into a single tab. The round trip is only lossless if the file used exactly four-space indentation to begin with; two- or three-space indentation will not survive it.
Is my data private when I use this tool?
Yes. This tool runs entirely in your browser using client-side JavaScript — nothing you type is transmitted to, logged by, or stored on any server. You can safely process confidential text, tokens, or code.