Skip to content

Tabs to Spaces Converter

Convert indentation between tabs and spaces, with tab stops handled properly.

Drop a code file here, or click to choose one

Converted on your device — the file is never uploaded

Converted

Quick Tool Overview

The Tabs to Spaces Converter detects how a file is indented and converts it either way, expanding tabs to real tab stops and leaving tabs inside lines alone unless you ask otherwise.

What it does
Converts indentation between tabs and spaces
You give it
Code or text
You get back
The same code, indented consistently
Best for
Linters, code reviews and mixed-indent files
Converters Free, unlimited use No sign-up Runs in your browser

About the Tabs to Spaces Converter

A file indented with both tabs and spaces looks right in the editor it was written in and ragged everywhere else, because every editor picks its own tab width. Linters fail, diffs fill with whitespace changes, and a pull request becomes unreadable.

Paste the code and it tells you what the file uses now — tabs, spaces or a mix — and what the indent step actually is, worked out from the widths that occur. Convert in either direction with a tab width of 2, 4 or 8. Tabs are expanded to the next tab stop rather than to a fixed run of spaces, which is what editors do and what keeps aligned code aligned. By default only the indentation changes, so a tab inside a TSV row or a string is left exactly as it is.

Key features of the Tabs to Spaces Converter

Detects what you have

Tabs, spaces or mixed — and the indent step actually in use.

Real tab stops

A tab advances to the next stop, which is what keeps alignment correct.

Indent only, by default

A tab inside a TSV row or a string is left exactly as it is.

Both directions

Spaces to tabs as well, keeping any leftover alignment spaces.

Mixed files flagged

The warning explains why the file looks different in each editor.

How to use the Tabs to Spaces Converter

  1. 1

    Paste or drop your code

    Any language — only whitespace is touched.

  2. 2

    Read what it uses now

    Tabs, spaces or mixed, with the indent step detected.

  3. 3

    Choose direction and width

    Spaces or tabs, at 2, 4 or 8 columns.

  4. 4

    Copy the result

    Paste it back, or download the file.

Frequently asked questions

Only if you ask. By default just the indentation changes, so a tab separating values in a TSV row or inside a string stays exactly as it is.

Reviews of the Tabs to Spaces Converter

What people who use the Tabs to Spaces Converter think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Tabs to Spaces Converter. It takes half a minute and no account.

Write the first review

More converters