Tab / Space Converter
Paste your code to convert indentation between tabs and spaces. Supports custom tab width and leading-indent-only conversion.
How to Use
Paste Your Code
Paste code that is indented with tabs or spaces into the input field.
Choose Options
Select the direction (tabs to spaces or spaces to tabs) and tab width. Keep the option on to convert leading indentation only.
View the Result
The converted result appears in real-time as you type. The number of changed lines is also shown.
Copy and Use
Click Copy to save the result to your clipboard and paste it into your editor.
About the Tab / Space Converter
A web tool that converts indentation in source code between tab characters and spaces. You can choose a tab width of 2, 4, or 8 and limit conversion to leading indentation. All processing happens in your browser, so the code you paste is never sent to any server.
Features
- Real-time ConversionConverts instantly as you type. No waiting for results.
- Selectable Tab WidthChoose a tab width of 2, 4, or 8 spaces to match your project style.
- Leading Indent OnlyConvert only leading indentation to avoid breaking spaces inside strings.
- Privacy ProtectedAll processing happens in your browser. Code is never sent to servers.
Use Cases
- Unify indentation to match your team coding style (tabs vs. spaces)
- Format indentation-sensitive languages like Python and YAML
- Normalize indentation to reduce noise in Git diffs
- Fix broken indentation in copied code
- Clean up Markdown code blocks and snippets
FAQ
Is the Tab / Space Converter free to use?
What does "Convert leading indentation only" mean?
Which tab width should I choose?
Spaces-to-tabs is converting spaces inside my text too.
Is the code I paste sent to a server?
Feedback
Missing a feature, or getting a result that looks wrong? Let us know — we improve our tools based on your feedback.