Convert indentation between tabs and spaces, in either direction - useful when your editor, a linter, or a teammate's formatting convention doesn't match your own, or when code pasted from one tool into another brings the wrong whitespace style with it.
Your text never leaves your browser. Everything is processed locally on your device.
Share:
Browser-only processing
Total lines
0
Non-blank lines
0
Blank lines
0
Words
0
Characters
0
Letters
0
Sentences
0
Input text
Result text
How do you use the tabs to spaces converter tool?
1. Add your text or code. Paste it directly, upload a file, or drop a TXT/CSV/JSON file onto the input box.
2. Pick a direction and width. Choose Tabs → Spaces or Spaces → Tabs, and set the width (2, 4, or 8 spaces per tab).
3. Copy or download the result. Your converted text is ready instantly, with nothing ever sent to a server.
Looking to clean up inconsistent spacing rather than convert between tabs and spaces? Try Remove Extra Spaces, or for several cleanups at once, see Text Cleaner.
Frequently Asked Questions
What is the actual difference between a tab and spaces?
A tab is a single character (the tab character, \t) that a text editor renders as some visual width - often 2, 4, or 8 columns, depending on editor settings. Spaces are literal space characters, each always exactly one column wide. Two files can look identical on screen while being made of completely different bytes underneath, if one uses tabs and the other uses an equivalent number of spaces.
Why does this matter for code specifically?
Because tabs and spaces are different characters, mixing them in the same file causes real problems: some linters and style guides reject one or the other outright, diffs can show a line as "changed" when only its indentation style shifted, and code that looks aligned in your editor can look misaligned in someone else's if their tab width is set differently. Picking one convention and converting everything to match it avoids all of this.
Does this preserve indentation depth correctly?
Yes, for exact matches: converting a tab to spaces always uses your chosen width consistently, and converting spaces to tabs only replaces runs of spaces that are exactly your chosen width - a 4-space run becomes one tab at width 4, an 8-space run becomes two. It intentionally does not round off odd-width runs (like 3 spaces at width 4) to the nearest tab boundary, since silently changing indentation depth beyond what you asked for could rewrite code structure you didn't intend to touch.
I just want to clean up messy spacing, not convert tabs - what should I use?
Use Remove Extra Spaces instead - it trims and collapses repeated spaces or tabs down to a single space, which is a different job than converting between the two consistently.