Spaces to Tabs

Convert space indentation to tabs — replaces every 4 spaces with a tab character instantly. Free, client-side indentation converter for code.

🔒 100% Client-Side Processing

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

0 / 100M Limit

Common Use Cases

Meeting tab-required formats

Makefiles require real tab indentation — convert space-indented recipes so make stops throwing missing-separator errors.

Matching team style

Convert space-indented code to tabs before contributing to a repo whose style guide mandates tab indentation.

Shrinking indentation size

Replace 4-space runs with single tab characters to compact deeply nested files.

Frequently Asked Questions

How many spaces convert to one tab?
Every run of exactly 4 spaces becomes one tab character — the most common indentation width. Code indented with 2-space levels will convert every two levels into one tab.
Why convert indentation to tabs at all?
Tabs let each developer choose their own display width, produce smaller files, and are required by some formats like Makefiles, where recipe lines must start with a real tab character.
What if my file uses two-space indentation?
It will be left alone. Only runs of exactly four spaces collapse to a tab, so two-space indentation passes through unchanged and six spaces become a tab followed by two spaces. Normalise the file to four-space indentation first if you need a clean conversion.
Will it touch spaces inside my code?
Any run of four spaces is converted, wherever it sits — including inside string literals, comments, and aligned trailing comments. Column alignment built from spaces is the usual casualty, since it very often contains runs of four.
Why would I want tabs rather than spaces?
Accessibility is the strongest argument: a tab is one character whose displayed width each reader controls, so a developer who needs eight-column indentation can have it without changing the file. Spaces hard-code one person's preference for everyone. The Tabs to Spaces tool converts the other way.
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.