Spaces to Tabs Converter
Replace configured runs of spaces with tab characters for indentation or text-format conversion. Processing takes place locally in your browser.
Start using
Spaces to Tabs Converter
Paste text and choose how many consecutive ASCII spaces form one tab (default 4). Run the action to replace each non-overlapping group of that size anywhere in the text with one tab character.
The size is truncated to a whole number and clamped to 1 through 16. Blank, zero or nonnumeric values fall back to 4. This avoids treating decimal group sizes as invalid regular-expression quantifiers.
At size 4, eight spaces become two tabs, and six spaces become one tab followed by two remaining spaces. Three spaces stay unchanged. The tool preserves all nonmatching characters and existing tabs.
Only ordinary ASCII spaces are converted. Nonbreaking spaces are not matched. This is a fixed-group replacement, not tab-stop alignment, leading-indent-only formatting or a language-aware code formatter; groups inside quoted text are also changed.
Processing is local to the browser with a copyable result. A tab's visual width depends on the receiving editor, and there is no source-file overwrite or file-format conversion.
N = 4 A B C ↓ A B C
Processing takes place locally in your browser.