Tabs to Spaces Converter (and back)
Text
Paste code or text and convert its leading indentation from tabs to spaces or from spaces to tabs. The tab width is configurable and tab stops are expanded correctly, so mixed tab/space indentation is normalized cleanly. Only the indentation at the start of each line is changed — spaces inside your text and alignment are left untouched. Everything runs locally in your browser — nothing is uploaded.
How to use
- Paste your code or text into the input box.
- Choose a direction (tabs to spaces or spaces to tabs) and set the tab width.
- Copy the re-indented result from the output box.
Frequently asked questions
- Does it change spaces inside a line?
- No. Only the leading whitespace at the start of each line is converted, so alignment and spaces within your text stay exactly as they were.
- What does tab width do?
- It sets how many columns a tab advances to. Converting tabs to spaces uses it to expand each tab to the next tab stop; converting spaces to tabs uses it to pack runs of spaces back into tabs.
- How is mixed tab/space indentation handled?
- Each line's leading whitespace is measured in visual columns using tab stops, then re-emitted entirely as tabs or spaces, so inconsistent indentation gets normalized.
- Is my text sent anywhere?
- No. Conversion happens entirely in your browser; nothing is uploaded.
Related tools
Markdown Table to CSV Converter
Convert a GitHub-flavored Markdown table into CSV, TSV or semicolon-separated rows, in your browser.
Markdown Table Generator
Paste CSV, TSV, or pipe-delimited data and get a properly aligned GitHub-flavored Markdown table.
Text Diff Viewer
Compare two pieces of text and see line-by-line or word-by-word additions and removals.
Lorem Ipsum Generator
Generate placeholder text by paragraphs, sentences, or words.
Case Converter
Convert text between UPPER, lower, Title, camelCase, snake_case and more.
Character & Word Counter
Count characters, words, sentences, lines, and bytes in real time.