Line Ending Converter

Normalize line endings by converting between CRLF, LF, and CR

Runs in your browserUtility02Converters

What is Line Ending Converter?

This line ending converter counts how many CRLF, LF, and CR breaks a text contains and rewrites every one of them to the format you choose. It is the standard fix for an entire file showing up as modified during cross-platform collaboration, and it runs entirely in your browser.

How to use Line Ending Converter

  1. 1Paste your text. A count of all three line-ending styles appears underneath.
  2. 2Choose the target line ending. Unix systems and Git repositories normally use LF.
  3. 3Copy the result back over the original content.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

# Normalize line endings repo-wide: commit a .gitattributes file
echo "* text=auto eol=lf" > .gitattributes

# Convert the existing files in bulk
find . -type f -name "*.ts" -exec sed -i 's/\r$//' {} +

Frequently asked questions

Why does Git show the whole file as changed?+

Because the ending of every single line changed. A Windows editor may rewrite LF as CRLF on save, and as far as Git is concerned that is a modification on every line. The permanent fix is a .gitattributes file in the repository declaring eol=lf, which makes Git normalize line endings on checkout and commit.

Is this why my shell script fails with "bad interpreter"?+

Very likely. When the shebang line #!/bin/bash is followed by a \r, the system goes looking for an interpreter literally named "bash\r" and fails to find it. Converting the file to LF line endings resolves it.

Related tools

All tools