Indentation converter

Switch leading indentation between tabs and spaces across many lines at once.

Only the whitespace at the start of each line is rewritten — tabs or spaces inside a line are kept. Up to 200,000 characters.

Direction

Converted in this browser. Nothing is sent anywhere.

Spaces→tabs replaces each run of N spaces with one tab and keeps any leftover spaces — re-running with a different width is not an exact undo. Lines that mix tabs and spaces keep that order.

How to use

  1. Paste the indented text.
  2. Pick the direction and width.
  3. Convert and copy the result.

What it supports

Only leading whitespace is converted — alignment inside a line is untouched. Spaces convert to tabs in full runs of the chosen width; leftover spaces stay. It does not detect a file's convention.

Related tools

Related guides