Convert Spaces to Tabs
Convert spaces to tabs instantly in your browser.
Tool workspace
Conversion runs in your browser. Nothing you paste is sent to our servers.
How many spaces equal one tab (default 4).
Leading only converts indentation; All spaces converts every matching run.
How it works
Leading only (default) converts only the indentation at the start of each line—like Unix unexpand. Each full group of tab-width spaces becomes one tab; leftover shorter runs stay as spaces. Conversion stops at the first non-space character (an existing tab in the indent ends the leading-space run). Line endings (CRLF, CR, LF) are preserved.
All spaces replaces every non-overlapping run of tab-width consecutive ASCII spaces with a tab anywhere in the text. Tabs already present, newlines, and Unicode space characters (such as non-breaking spaces) are left unchanged.
Results update as you type (light debounce) or when you press Convert. Empty input produces an empty result—no error. Processing runs entirely in your browser.
Examples
- hello → ⇥hello (leading, width 4)
- hello → hello (leading, width 4; leftover spaces)
- hello world → hello⇥world (all spaces, width 4)
- a b → ⇥a / ⇥b (leading, both lines)
- (empty) → (empty)
Privacy
FAQ
Is my text uploaded to a server?
No. Spaces-to-tabs conversion runs entirely in your browser. Pasted content is not sent to Nova Engine.
Do I need an account?
No. All published tools work for guests without login.
What is tab width?
Tab width is how many consecutive ASCII spaces equal one tab. Choose 2, 4, or 8. The default is 4.
Leading only vs All spaces?
Leading only converts indentation at the start of each line. All spaces converts every matching run of spaces anywhere in the text, including between words.
Are existing tabs changed?
No. Existing tabs stay as-is. Only ordinary ASCII spaces are converted.