Tabs to Spaces Converter
Convert your code's indentation between tabs and spaces instantly. 100% in your browser.
Built by
Miguel Ángel Colorado Marin (MACM)
Built by
Miguel Ángel Colorado Marin (MACM)
Full-Stack Developer · Guadalajara, España
I develop web apps, digital tools and full projects — from design to deployment.
This tool converts a code block's indentation between tabs and spaces, useful when you switch editors, follow a new team style standard, or simply prefer one indentation type over the other. Paste your code, choose the conversion direction (tabs to spaces or spaces to tabs) and the indentation width (2, 4 or 8 spaces per level), and the result is generated instantly, ready to copy. All processing happens with JavaScript directly in your browser.
Features
- ✓Tabs to spaces and spaces to tabs
- ✓2, 4 or 8 indentation width
- ✓Instant conversion as you type
- ✓Copy to clipboard with one click
- ✓100% in browser, no uploads
How to convert tabs to spaces?
- 1
Paste your code
Type or paste the code in the box on the left.
- 2
Choose the direction
Tabs → Spaces or Spaces → Tabs.
- 3
Choose the width
2, 4 or 8 spaces per indentation level.
- 4
Copy the result
The converted code appears instantly, ready to copy.
Frequently asked questions
Is my code uploaded to a server?
No. Everything is processed with JavaScript directly in your browser.
What indentation width should I use?
It depends on the language and your team's style: 2 spaces is common in JavaScript/TypeScript, 4 in Python and Java.
Does it respect the rest of the code, not just the indentation?
Yes, it only modifies the tabs or spaces at the start of each line (the indentation), the rest of the content stays intact.
Related tools
Embed Tabs to Spaces Converter on your site
Add Tabs to Spaces Converter to any web page with a simple iframe. Free, with attribution to miguelacm.es.
<iframe
src="https://miguelacm.es/embed/tabs-spaces-converter"
width="100%"
height="700"
frameborder="0"
title="Tabs to Spaces Converter — miguelacm.es"
></iframe>View embed in new tab →