Line Ending and Tab Converter
Open a text file or paste text. See how many Windows, Unix and old Mac line endings it has and convert them, or swap tabs and spaces with a width you choose, then copy or download the result.
Open a text file to keep its line endings exactly as they are. Pasted text cannot show them.
Tabs are replaced up to the next tab stop, so text stays lined up.
Worked examples
Counting endings
a CRLF b LF c CR d CRLF
2 CRLF, 1 LF, 1 CR
Each ending is counted on its own.
Tab stops
ab, tab, c with width 4
ab··c
Two spaces, shown here as dots, reach the next tab stop.
About Line Ending and Tab Converter
Windows ends a line with two characters, a carriage return and a line feed (CRLF). Linux and modern macOS use only the line feed (LF), and very old Mac systems used only the carriage return (CR). Mixed endings cause noisy diffs, shell scripts that fail with errors about a stray ^M or a missing interpreter, and files that look fine in one editor and wrong in another. Tabs and spaces cause a similar kind of trouble in indentation.
Open a file here and the tool counts each kind of ending, then rewrites every one to the style you pick, with an option to make sure the file ends with a line break or to remove it. A text box cannot hold a carriage return, which is why opening a file is the reliable way to see and fix them. The tab options replace tabs with spaces using proper tab stops, so text stays lined up, or turn indentation into tabs. The result can be copied or downloaded.
How to use Line Ending and Tab Converter
- Choose to change line endings, tabs to spaces, or spaces to tabs.
- Open a text file, or paste text.
- Pick the target ending and the final line break option, or the tab width.
- Copy the result or download it as a file.
Common uses
- Fixing a shell script that came from a Windows editor
- Making a repository consistent before a commit
- Converting indentation to match a style guide
- Preparing a file for a system that expects CRLF
Frequently asked questions
Why can I not see carriage returns in the text box?
Text boxes in web pages turn every line break into a plain line feed. Open the file with the chooser to read it exactly as it is, and the counts will be correct.
Which ending should I use?
Use LF for shell scripts, source code in most repositories and anything for Linux or macOS. Use CRLF for Windows batch files and for tools that expect it.
How are tabs replaced?
A tab moves to the next tab stop, so it is replaced by as many spaces as it takes to reach the next multiple of the width. This keeps columns aligned.
What does the leading-only option do?
When turning spaces into tabs, it changes only the indentation at the start of each line, and leaves spaces inside the line alone.
Does it change the text itself?
No. Only line endings, or tabs and spaces, are changed. Other characters are copied exactly.