Find and fix mixed line endings
See how many LF, CRLF, and lone CR endings a text has, then convert everything to one style.
Tools used in this guide
The job
Text assembled across Windows, Mac, and web forms often ends up with mixed line endings. Git diffs get noisy, scripts see phantom differences, and some parsers choke. First look at what is inside, then normalize to the ending your tools expect.
How to do it
Paste the text or load the file directly — .txt, .csv, and source files all work — then pick the target: LF for Unix/Mac tooling and most scripts, CRLF for Windows pipelines, CR only for legacy Mac formats. Convert, then copy the result. The count line shows what was found and what the result now contains, so you can confirm the mess is gone. Pasted and loaded text keeps its real endings, which is what makes the mixed count possible at all.
Worked example
A CSV exported from Excel and edited on a Mac reports “CRLF 12 / LF 8” — twenty lines, two conventions. Convert to LF and the after-count reads “LF 20”: uniform, diff-clean.
Limits
Every ending is rewritten — there is no partial or per-line choice, so do not run it on files that must keep mixed endings. Characters between endings are never touched. Cap: 200,000 characters, and it works on text, not binary files.