Line Ending Converter
Normalize line endings by converting between CRLF, LF, and CR
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
- 1Paste your text. A count of all three line-ending styles appears underneath.
- 2Choose the target line ending. Unix systems and Git repositories normally use LF.
- 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 toolsJSON to YAML Converter
Convert JSON to YAML while preserving the nesting
YAML to JSON Converter
Convert YAML to JSON, multi-document files included
JSON to CSV Converter
Convert a JSON array of objects to CSV, with nested fields flattened automatically
CSV to JSON Converter
Convert CSV to JSON with automatic header and delimiter handling
JSON to TypeScript
Infer TypeScript type definitions from JSON
JSON to Go Struct
Convert JSON to Go structs with json tags filled in