Skip to content
Test versionSearch

Developer tools

Convert tabs and spaces

Tabs to spaces replaces every tab with the selected fixed number of spaces, including tabs inside a line. Spaces to tabs changes only leading indentation, retaining leftover spaces. Existing leading tabs count as a fixed width. This is not tab-stop alignment or a code formatter; inspect whitespace-sensitive code.

How it worksFAQRelated tools

Content reviewed:

Also available for Germany, in German 

Paste text, choose options and calculate. Up to 20,000 UTF-16 code units (an emoji can use more than one). Empty input is allowed except for naming conversion.

Processing stays in this browser tab. Input is not sent, saved in browser storage or added to the URL. The original TXT download contains the result. The additional JSON export contains the input, selected options and exact result. Copy may require permission; selecting text is available as a fallback. Changing an input clears the previous result. Optional own UTF-8 file up to 32 KiB and 20000 UTF-16 units; raw file and form line endings are recorded separately. CSV protects formula-like lines with an apostrophe; printable HTML refuses unsupported control characters. Optional live calculation is off by default.

How it works

Tabs to spaces replaces every tab with the selected fixed number of spaces, including tabs inside a line. Spaces to tabs changes only leading indentation, retaining leftover spaces. Existing leading tabs count as a fixed width. This is not tab-stop alignment or a code formatter; inspect whitespace-sensitive code. Shared own file and JSON/numbered-line CSV/printable HTML exports record the unchanged calculation result and actual selected options. Processing stays in this browser tab. Input is not sent, saved in browser storage or added to the URL. The original TXT download contains the result. The additional JSON export contains the input, selected options and exact result. Copy may require permission; selecting text is available as a fallback. Changing an input clears the previous result. Optional own UTF-8 file up to 32 KiB and 20000 UTF-16 units; raw file and form line endings are recorded separately. CSV protects formula-like lines with an apostrophe; printable HTML refuses unsupported control characters. Optional live calculation is off by default.

Worked example

Example input: first second

Worked example

With these example values the calculator gives the result below. You can change any value in the form above.

Inputs

Input text
Own sample Own second line
Operation
Tabs to spaces
Spaces per tab
4

Result

Result
Unicode code points: 34

Frequently asked questions

How do I convert tabs to spaces?

Choose tabs to spaces and a fixed number of spaces. Every tab is replaced, including tabs inside a line.

How do I convert spaces to tabs?

Choose spaces to tabs. Only leading indentation changes, and leftover spaces are retained.

How are existing leading tabs counted?

Existing leading tabs count as a fixed width.

Is this a code formatter?

No. It is not tab-stop alignment or a code formatter, so inspect whitespace-sensitive code.

How much text can the indentation converter process?

Up to 20,000 UTF-16 code units, or an optional UTF-8 file of up to 32 KiB.

What can I download?

Exact result JSON, a numbered line CSV and a printable result HTML.