Convert tabs to spaces (or spaces to tabs) instantly — choose your indent width, preview whitespace characters, and copy the result in one click.

Related Tool: Format HTML → HTML Beautifier

Mode:
Tab Width:

INPUT
OUTPUT (tabs → spaces)
Copied!
Lines: 0 Input chars: 0 Output chars: 0 Tab stops (input): 0 Space indents (input): 0 Trailing WS lines: 0

How it works:

  • Tabs → Spaces: Each tab is expanded to the next tab-stop boundary using the chosen width (2, 4, or 8 spaces).
  • Spaces → Tabs: Only leading whitespace is converted — groups of N spaces become one tab. Remaining partial spaces are kept.
  • Whitespace preview: Spaces show as ·, tabs show as so you can verify the conversion at a glance.
  • Trim trailing whitespace: Strips any spaces or tabs at the end of each line.
  • Normalize line endings: Converts Windows CRLF and old Mac CR to Unix LF.