Code

Convert Line Endings — CRLF, LF and CR

Converts between CRLF, LF and CR endings and reports mixed or missing ones.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Paste or upload the file.
  2. Choose the ending you want: LF for anything Unix, Git or Docker touches, CRLF for Windows tools that need it.
  3. Select Convert, and read the summary to see what the file had before.

What line ending converter does

Line endings are invisible until they cause a problem, and then they cause a strange one: a shell script that reports a command not found with a name that looks right, a diff where every line changed, a file that a parser reads as one enormous line. This tells you what is actually in the file and converts it to what you want.

Mixed endings within one file are called out separately, because that is the case most likely to be a merge or an editor going wrong rather than a deliberate choice. A missing final newline is also reported — harmless in most places, but it is what makes POSIX tools concatenate two files into one broken line, and it is why some linters complain.

Frequently asked questions

LF for almost everything: Git, Docker, Linux, macOS and every modern editor handle it. CRLF only for Windows tools that genuinely require it — Notepad on older Windows, some legacy parsers. CR alone is from classic Mac OS and you will only meet it in very old files.

A shell script with CRLF endings fails with a command-not-found message naming a command that looks correct, because the carriage return is part of the name. In Git, a whole file can show as changed when nothing was edited. A parser reading CR-only text can see the file as one very long line.

Usually not, but it is reported because it has real consequences: POSIX tools concatenating two such files run the last line of one into the first line of the next, many linters flag it, and Git marks it in every diff of the file.