Newline Normalizer
Detect and convert line endings between LF, CRLF and CR.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Mixed endings (1 CRLF, 1 LF, 1 CR); converted to LF.
How it works
- Counted CRLF, bare LF and bare CR sequences.
- Normalised every ending to LF first, then to the requested style.
- The last line without a trailing newline is left unchanged; only existing line breaks are converted.
- CRLF is the convention on Windows, LF on Unix and in Git's default repository blob form.
Methodology
- Count CRLF, bare LF and bare CR sequences.
- Normalise the text to LF, then re-apply the requested ending.
- Report the original counts, whether they were mixed, and the converted text.
Usage
- Paste the text with the line endings to inspect.
- Choose the target ending (LF, CRLF or CR).
- Read the detected counts and copy the converted text.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Mixed endings to LF
{
"text": "a\r\nb\nc\rd",
"style": "lf"
}LF to CRLF
{
"text": "one\ntwo\n",
"style": "crlf"
}No line breaks
{
"text": "single line",
"style": "lf"
}Limitations
Why line endings get mixed
Different editors and operating systems use different line terminators: LF (`\n`) on Unix, CRLF (`\r\n`) on Windows and a bare CR (`\r`) on classic Mac OS. When a file is edited across systems without normalisation, it can end up containing several kinds at once.
Mixed endings produce whole-file diffs and can break shell scripts (a `\r` at the end of `#!/bin/sh` makes the interpreter unfindable). Normalising to a single style before committing avoids both.
Frequently asked questions
- Which line ending should I use?
- Use LF in the repository and let `.gitattributes` (`* text=auto`) handle checkouts on Windows, unless your project standard says otherwise.
- What is a mixed file?
- A file that contains more than one kind of line ending; that is what most commonly causes noisy diffs and is what this tool reports as mixed.
Sources
- The Open Group Base Specifications: Definitions — The Open Group
- Git: gitattributes text and eol — Git
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.