Replace Tabs With Spaces
Convert tab characters to spaces for consistent indentation.
Text Tools Runs in your browser
How do you replace tabs with spaces?
Each tab character in your paste becomes four spaces, nothing more. A line indented \t\tif (ready) { comes back as eight spaces then the code, so the file renders the same in an editor set to 2-wide tabs, a diff view, or a web form that eats tabs entirely. Existing spaces and line breaks pass through untouched.
How to use the Replace Tabs With Spaces
- 1 Paste tab-indented code or text.
- 2 Every tab converts to four spaces on the spot.
- 3 Verify the indentation depth looks right in the output.
- 4 Copy the space-only version.
What you can use it for
- Normalising indentation before sharing code.
- Fixing alignment in pasted snippets.
- Meeting a style guide that bans tabs.
- Preparing text for systems that mishandle tabs.
Frequently asked questions
Can I change the number of spaces per tab?
No, the width is fixed at four, the most common indentation unit. For a different width, convert here first, then use the text replacer on groups of four spaces.
Are tabs in the middle of a line converted too?
Yes, every literal tab character converts, not just leading indentation, which also fixes tab-separated columns you want as spaced text.
Will my line endings survive?
They will. Only the tab character is touched; newlines, existing spaces and everything visible remain exactly as pasted.
Related tools
More Text Tools
More tools like this:
All Text Tools