Skip to main content
FixLines

Convert tabs to spaces

Swap tab characters for spaces, or the other way round.

Editor

Ln 1, Col 10 lines0 words0 characters

Convert tabs to spaces: what it does

Tabs show differently in every editor, which breaks the layout of code and tables. Replace each tab with a fixed number of spaces, or go the other way and turn groups of four spaces into tabs.

Convert tabs to spaces: how to use it

  1. Paste the text that contains tabs or indentation.
  2. Choose the tool and, for tabs to spaces, the number of spaces per tab.
  3. Select Apply and copy the result.

Convert tabs to spaces: when to use it

  • Match the indentation rules of a project before committing code that was written with tabs.
  • Fix a Python or YAML file that fails because tabs and spaces are mixed.
  • Paste tab-separated data into a place where tabs are lost or shown wrongly.

Convert tabs to spaces: examples

Tabs to four spaces

Input

name	color
apple	red

Result

name    color
apple    red
Convert indentation with two spaces per tab

Input

if ready:
	start()
		log()

Result

if ready:
  start()
    log()

Convert tabs to spaces: questions and answers

How many spaces does a tab become?

You choose from 1 to 16; four is the default. Spaces to tabs always uses groups of four.

Does it work on code?

Yes. It changes only the indentation characters, so your code stays the same otherwise.

Does it change tabs in the middle of a line?

Yes. Every tab character is replaced, wherever it is, including tabs that separate columns.

Why did Spaces to tabs leave some spaces?

Only groups of four spaces become a tab. Two or three leftover spaces are kept so the alignment of the text does not change.

Is my text sent to a server?

No. Everything runs in your browser on your own device, so your text never leaves it.

Tools people often use together with this one.

More in Clean upBrowse all text tools