Normalize Line Endings
Convert all line endings to a consistent style — LF (Unix), CRLF (Windows), or CR (classic Mac).
About Normalize Line Endings
Different platforms use different sequences for line breaks: Unix and modern macOS use LF (\n), Windows uses CRLF (\r\n), and classic Mac OS used CR (\r). Mixing them in one file can break tools, lint checks, and diffs. This converter normalizes every line ending in your input to a single chosen style.
When to use it
- Fixing 'shebang line not recognized' errors caused by CRLF on Unix
- Cleaning up files edited on multiple platforms
- Preparing text for a parser that's strict about line endings
- Resolving git diff noise from mixed line endings
How it works
Every existing line ending (LF, CRLF, or CR) is matched and replaced with the chosen target. The substitution is purely textual — file content remains otherwise identical.
Examples
Mixed input → unified LF output
Line 1\r\nLine 2\nLine 3 (target=LF)
Line 1\nLine 2\nLine 3
Frequently asked questions
- Which target should I use?
- LF for source code, Unix scripts, and most modern web content. CRLF for files that will be opened by Windows-specific tools (Notepad, some PowerShell scripts). CR (classic Mac) is essentially obsolete.
- Will my file size change?
- Yes — slightly. Converting LF → CRLF adds one byte per line. Converting CRLF → LF removes one byte per line.
- Does it preserve a final newline?
- Yes. If the input ends with a line break, the output ends with the new line break too.