Spaces to Tabs
Convert runs of spaces to tabs, either everywhere or only in indentation.
Browser onlyYour data never leaves this device.
Runs entirely in your browser. Your text never leaves this device and is never stored.
Details: Privacy policy
Input
Complete space groups are converted live. Nothing is stored.
Whole number from 1 to 16.
Result
No text yet.
Paste space-indented text above.
Spaces to Tabs turns groups of spaces into tab characters in one of two scopes. Groups mode replaces every complete run of the chosen width anywhere in a line, which is the blunt conversion you want when a system measures indentation in tabs and the text is already uniformly spaced. Leading mode is the careful one: it rewrites only the spaces at the start of each line, leaving the spaces between words exactly as they were, so prose does not lose its word gaps. Leftover spaces smaller than the width stay spaces rather than being rounded up, which keeps the visible indentation honest. Existing tab characters are not touched, line endings normalise to LF, and the result reports how many tabs were produced. The page states the limitation that matters for code: this is a width-based conversion, not an alignment engine, so a file whose columns were aligned with mixed indentation may shift when the tab width differs from the one the author used. It is the tool for making a space-indented file acceptable to a tab-indented project, and for reducing indentation size without touching the words. The conversion never creates mixed indentation deliberately: a run that does not divide evenly leaves its remainder as spaces, so the visual width is preserved but the character mix is not uniform.
How to use Spaces to Tabs
- Paste text containing space indentation.
- Choose groups or leading-only mode and set the width.
- Copy the converted text or clear to start over.
What you get
- The text with complete space runs, or leading indentation, replaced by tabs.
- A count of tabs produced.
- Leftover spaces and all non-space characters preserved.
When to use Spaces to Tabs
- Convert four-space indentation to tabs before committing a code sample.
- Tabify a uniformly spaced list without altering spaces between words.
- Reduce indentation width in a pasted snippet while keeping its shape.
Frequently asked questions about Spaces to Tabs
Which mode should I use for code?
Leading-only, usually. Groups mode also converts spaces between words, which is rarely what source code needs.
What happens to spaces that do not fill a whole group?
They remain spaces. A three-space indent with a width of four stays three spaces rather than becoming a tab.
Are existing tabs changed?
No. The conversion only looks at spaces; tabs already in the text are left exactly as they are.
Is my text uploaded?
No. Conversion runs in your browser; nothing is sent to a server or stored.
Tools related to Spaces to Tabs
- Tabs to Spaces
Convert tabs to spaces at a fixed width, or align them to tab stops.
- Add Line Numbers — prefix every line with a counter: custom start
Prefix every line with a counter: custom start, step, and separator.
- Case Converter
Switch text between uppercase, lowercase, title, and sentence case.
- Number to Arabic Words — convert numbers and currency amounts into written
Convert numbers and currency amounts into written Arabic words and legal tafqeet format.
- Obfuscate Text
Apply ROT13 to letters, hiding text from a casual glance but not from anyone determined.
- Old English Text Generator — convert letters into Unicode blackletter (Fraktur)
Convert letters into Unicode blackletter (Fraktur) characters for a Gothic look.
⚡Embed Spaces to Tabs on Your Site & Get Badge↓
Embed this in-browser tool into any blog, documentation, or dashboard. Includes an optional dofollow backlink badge to credit Tools Hub.
<iframe src="https://salaq.com/embed/text/spaces-to-tabs" title="Spaces to Tabs — Tools Hub" width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden;max-width:100%;" loading="lazy"></iframe>
<p style="font-size:12px;color:#6b7280;margin-top:6px;font-family:system-ui,-apple-system,sans-serif;">Powered by <a href="https://salaq.com/tools/text/spaces-to-tabs" target="_blank" rel="noopener" style="color:#2563eb;text-decoration:underline;">Spaces to Tabs on Tools Hub</a></p>Feedback
Send feedback about this tool (placeholder — feedback collection is not wired up yet).