Tabs to Spaces & Line Ending Converter
Fix indentation and line endings in code or text files: tabs ↔ spaces, Windows ↔ Unix line endings, and trailing spaces.
How to use the Tabs to Spaces Converter
- Paste or open a fileOpen the file to keep its exact line endings; pasted text loses Windows line endings in most browsers. The stats show which line endings and how many tabs the file has.
- Choose the changesConvert tabs to spaces (or back), pick a tab width, change line endings to LF or CRLF, trim trailing spaces and add a final new line.
- Download the resultDownload keeps the line endings you chose. Copy also copies them exactly.
Example
The sample uses CRLF ×5 line endings and has 4 tabs. With tabs → 4 spaces, \t\treturn becomes 8 spaces before return.
Trimming removes the spaces at the end of 2 lines, and choosing LF converts the file to Unix line endings.
Frequently asked questions
What are LF and CRLF?
They are the characters that end a line. Linux and macOS use LF (\n); Windows uses CRLF (\r\n). Mixing them causes noisy diffs in Git and errors in some scripts, such as bash scripts saved with CRLF.
Does tab width matter?
Yes. A tab moves to the next multiple of the tab width, so a tab after 2 characters with width 4 adds only 2 spaces. The tool follows this rule, like a code editor.
What does “Only leading indent” mean?
Only the tabs or spaces at the start of each line are changed. Tabs inside the text, for example in strings or aligned comments, are left as they are.