Tab to Space Converter

Paste code or text, choose tab width (2, 4, or 8 spaces), and instantly replace every tab with the correct number of spaces.

Input

Tab width:

Output

Copied!

Summary

Paste code or text, choose tab width (2, 4, or 8 spaces), and instantly replace every tab with the correct number of spaces.

How it works

  1. Paste or type your code or text into the input area.
  2. Select the desired indent width: 2, 4, or 8 spaces.
  3. The output area updates in real time with tabs replaced by spaces.
  4. Click "Copy Output" to copy the converted text to your clipboard.
  5. Use the "Clear" button to reset both panels and start over.

Use cases

  • Fix indentation before pasting code into a YAML or Python file.
  • Normalize mixed tab/space indentation in legacy source files.
  • Prepare code snippets for editors that require spaces over tabs.
  • Convert tab-delimited text before importing into spreadsheet tools.
  • Standardize code style across team members who use different editors.
  • Remove tab characters from config files that reject them.

Frequently Asked Questions

Last updated: 2026-06-09 · Reviewed by Nham Vu