Skip to content
Tooldict

Tabs to Spaces

Replaces tab characters in your text or code with the number of spaces you choose.

Result

About

Because tab width varies between editors, shared code can lose its alignment. Converting tabs to a fixed number of spaces gives consistent indentation (commonly 2 or 4 spaces).

Everything runs in your browser; your content is never uploaded.

How to use

  1. Paste your text or code into the box.
  2. Enter how many spaces each tab should become (4 by default).
  3. Copy the converted text.

Frequently Asked Questions

How many spaces should I pick?
Common choices are 2 and 4 spaces. Pick whatever matches your project's style.
Can it convert spaces back to tabs?
This tool converts tabs to spaces. For the other direction, use the remove-extra-spaces tool.

Other tools

Embed this tool

Copy the code below and paste it into your site's HTML to embed this tool for free. The snippet includes an attribution link back to the source.

<iframe src="https://tooldict.com/embed/en/tabs-to-spaces" title="Tabs to Spaces" width="100%" height="600" style="border:1px solid #e2e8f0;border-radius:16px;max-width:680px" loading="lazy"></iframe>
<p style="font:13px/1.5 sans-serif">Powered by <a href="https://tooldict.com/en/tabs-to-spaces" target="_blank" rel="noopener">Tabs to Spaces</a> — Tooldict</p>