Convert Tabs to Spaces

Replace every tab with aligned spaces instantly.

Options

Tab stops every N columns. Whole number from 1 to 32, default 4.

The result updates as you type. Ctrl + Enter converts now.

Spaces text

How to convert tabs to spaces

Paste your text into Your text, or press Load example. Set Spaces per tab if you need a different tab size. The expanded version appears next to it and updates as you type. Copy the result or download it as a .txt file. Everything runs in your browser, so nothing you paste is uploaded.

Examples

InputOutput (size 4)
Name Age Name Age
a b a b
indented indented

Limits and edge cases

  • Tabs use tab-stop alignment: each tab advances to the next multiple of the tab size. With size 4, "a" plus a tab becomes "a" plus 3 spaces (column 1 to 4), while "ab" plus a tab becomes "ab" plus 2 spaces (column 2 to 4).
  • Every character counts as 1 column, including wide characters and emoji. Display width is not used.
  • Windows CRLF line endings are preserved and the column resets at each new line.
  • Tab size accepts whole numbers from 1 to 32 and defaults to 4. Invalid values fall back to 4.

Frequently asked questions

How do I convert tabs to spaces?

Paste your text into the input box, set the spaces per tab if needed, and the expanded version appears instantly. Copy it or download it as a .txt file.

What is tab-stop alignment?

Each tab jumps to the next multiple of the tab size. With size 4, a tab after one character adds 3 spaces, but a tab after two characters adds 2 spaces, so columns stay aligned.

What tab size should I use?

The default is 4 spaces per tab stop, which matches most editors. You can set any whole number from 1 to 32.

Does it keep my line breaks?

Yes. Lines are processed one by one and Windows CRLF endings are preserved, so pasted code keeps its shape.

How are emoji and accented characters counted?

Each character counts as one column regardless of how wide it looks on screen, so a tab after an emoji advances the same as after a letter.

Is my text uploaded anywhere?

No. Conversion runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.