Line Endings: The Cross-platform LF, CRLF, CR Problem

Open Tool Line Ending Converter

Three endings, three habits

Line endings are invisible characters with different conventions: Unix-like systems use one newline, Windows uses carriage return plus newline, early Macs used carriage return alone. They look identical on screen and differ in bytes. In cross-platform work, mixed endings make diffs show whole-file changes, scripts fail with strange errors and an invisible character appears at line ends. The tool converts to any of the three and copies or downloads results.

Steps

  1. Paste the text or confirm the original file's ending type.
  2. Choose LF, CRLF or CR for the target.
  3. Run it and check the line count holds.
  4. Copy or download and open in the target system.
  5. Load the sample or clear to start again.
  6. For batches, back up first and convert file by file.

Scripts, repositories, protocols

Scripts suffer most: a Unix script with Windows endings carries an extra carriage return in its header, the interpreter cannot find the path, and the error often says only that the file is missing. Repositories need one ending policy, and version control's auto-conversion can rewrite files repeatedly when local and remote rules disagree. Mixed endings in config and data files let parsers treat the trailing return as content, adding a stray character to a field. Network headers require carriage return plus newline, and any change breaks the request.

Common mistakes

A Windows-ending script reporting a missing path on Linux. Mixed endings making every commit a whole-file change. Editing files without adjusting version control so the next pull reverts them. Converting a binary as text and corrupting it. Parsers absorbing the return into fields. And unverified line counts after conversion, hiding lost or added blank lines.

Where conversion must stop

Binaries never touch a text tool, or they break outright. Signed files fail validation after any ending change. Database exports follow the importing side's requirement rather than local habit. Teams agree a format before batch conversion instead of acting separately. And casual ending cleanup invites problems that take hours to locate.

⏫︎