Skip to content
Jellykit

Line Ending Converter (CRLF, LF, CR)

See whether text files use Windows CRLF, Unix LF or old Mac CR line breaks, and convert a whole batch to one style.

  • Runs on your device
Loading tool

About Line Ending Converter (CRLF, LF, CR)

Text files end their lines in one of three ways: CRLF on Windows, LF on macOS and Linux, and a lone CR on Macs from before 2001. Mixing them up breaks shell scripts ("bad interpreter: /bin/bash^M"), shows every line of a diff as changed, and leaves stray ^M characters in editors.

Drop the files and each one is listed with the line breaks it holds, including files that mix styles. Choose the ending you want and every break is rewritten. Only the line breaks change: the encoding, a byte order mark and every other byte stay as they were.

How it works

  1. Each file is scanned for line breaks: a CR followed by an LF counts as one CRLF, and any other CR or LF counts on its own.
  2. Converting replaces every break with the chosen one and copies everything between them unchanged, so UTF-8, Latin-1 and other ASCII-based encodings are safe.
  3. UTF-16 and UTF-32 files are recognised by their byte order mark and converted in two- or four-byte units. Without a mark, a file containing zero bytes is treated as binary and left alone.

Questions

Which ending should I choose?

LF for code, scripts and anything used on macOS, Linux or the web; CRLF for files that older Windows editors or batch scripts expect. CR is only for very old Mac software.

Does it change anything else in my file?

No. The trailing line break, if there is one, stays; no break is added to a last line that has none; and spaces, tabs and the encoding are untouched.

What happens to a file that already uses the ending I chose?

It is reported as having nothing to change, so you do not download an identical copy. Files that mix styles are always converted.

How large can the files be?

Up to 200 MB each. Each file is read into memory in this browser to be converted, and nothing is uploaded.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.