Tabs to Spaces

Tabs to Spaces lets you expand each tab to the next tab stop while preserving existing spaces and line breaks. Enter your own values or load the worked example.

Method and calculation

Expand each tab to the next tab stop while preserving existing spaces and line breaks.

Inputs and settings

Tabs to Spaces accepts Indented text; Tab stop width (minimum 1, maximum 16).

Worked example

Tabs to Spaces example — Indented text: "function hello() {\n\treturn true;\n}"; Tab stop width: 4. Computed output: function hello() { return true; }

Output and limitations

Tabs to Spaces: Input is treated as plain text; it is never executed.

Technical references: JavaScript Unicode normalization

Tabs to Spaces FAQs

Tabs to Spaces applies the following rule to your input: Expand each tab to the next tab stop while preserving existing spaces and line breaks. The worked example on this page uses the same processor as the result button.
Tabs to Spaces has these boundaries: Input is treated as plain text; it is never executed. Start by checking the indented text field against the units or format shown.
Tabs to Spaces provides this sample: function hello() { return true; }. Use the sample button to reproduce it, then replace the inputs with your own values.