Convert tabs to spaces (and back)

Convert tabs to spaces or space indentation to tabs — useful when a project requires a specific indentation style in its configuration file.

Example:

How it works

"Tabs → Spaces" replaces every tab character with the chosen number of spaces, wherever it appears in the text. "Spaces → Tabs" only touches indentation at the start of a line: each complete group of consecutive spaces (of the chosen size) at the beginning of a line is replaced with a tab, and the rest of the line is never modified. This is useful for standardizing a code file before submitting it to a project that enforces a particular indentation style (for example a linter configured to require tabs).

Are spaces in the middle of a line converted to tabs?

No, only indentation at the start of a line is affected by the "Spaces → Tabs" conversion: spaces that appear in the middle of a line (for example between words) are never touched.

What happens if the indentation isn't an exact multiple of the chosen number of spaces?

The remainder that doesn't form a complete group is kept as spaces after the generated tabs, so no indentation character is lost.

100% local processing: your code never leaves your browser, and the conversion runs entirely via WebAssembly on your device.