Convert tabs to spaces or spaces to tabs in code. Configurable indent width (2/4/8), preserve indentation, and one-click conversion. 100% free, private,.
Tab to Spaces is a code utility that converts tab characters (\t) into a configurable number of space characters, or the reverse. It eliminates inconsistent indentation when files originate from different editors, contributors, or coding standards. The conversion preserves the visual layout while making whitespace deterministic.
Tabs and spaces look identical in the editor but behave differently across tools: diff utilities flag them as changes, linters reject mixed indentation, and Python actually treats them as syntax errors. Using one style consistently keeps repositories clean and pull requests focused on real changes.
.editorconfigEvery tab character in the input is replaced with the configured number of spaces (default four). When converting the other direction, leading runs of spaces are grouped into tabs based on the same width. Trailing whitespace and inline spaces inside string literals are left untouched so your code's behavior never changes — only its indentation.
Onboarding a new contributor whose editor inserts tabs into a spaces-only repo. Cleaning up legacy code before adopting an automatic formatter like Prettier or Black. Pasting code from documentation that uses one style into a project that uses another. Preparing snippets for a blog post or Markdown file where inconsistent indentation breaks code blocks.
Conversion happens entirely in your browser — nothing is uploaded, no telemetry is collected, and the input disappears as soon as you close the tab.
Use the JS Minifier to strip whitespace entirely. Format JSON with the JSON Formatter. Add line numbers with the Line Number Adder.
Different projects and editors use different indentation standards. Converting ensures consistency across your codebase.
2 spaces (JavaScript, Ruby) and 4 spaces (Python, Java) are the most common. Some teams prefer tabs.
Yes. Only tab characters (→spaces) or leading space groups (→tabs) are converted.
Browse all free tools · Guides and tutorials · PDF tools · Developer tools · Text tools · SEO tools