⇥ Tab to Space Converter

Convert tabs to spaces and vice versa. Customizable number of spaces per tab — all in your browser, no upload, instant results.

About the Tab to Space Converter

This tab to space converter runs entirely in your browser. Type or paste text into the input box, set the number of spaces per tab, and click Tabs to Spaces or Spaces to Tabs to convert indentation. Nothing is uploaded to a server — the conversion happens instantly with JavaScript on your device.

How it works

  • Tabs to Spaces — Every tab character (\t) is replaced with the chosen number of space characters.
  • Spaces to Tabs — Every run of N consecutive spaces (where N is "Spaces per tab") is replaced with a single tab character.

How to use the converter

  1. Paste or type your text in the input box.
  2. Set the number of spaces per tab (1–8).
  3. Click Tabs to Spaces or Spaces to Tabs.
  4. The result appears in the output box. Click Clear to start over.

Frequently asked questions

Does this tool upload my text? No. All conversion happens locally in your browser. Your text never leaves your device.

What is the default spaces per tab? The default is 4, which is the most common convention. You can change it to any value from 1 to 8.

What happens to spaces that don't form a full group when converting to tabs? Leftover spaces that don't fill a complete tab group are kept as spaces in the output.

Is there a length limit? The only limit is your browser's available memory. Even very long texts convert instantly.