Text tools
Line Ending Converter
Convert CRLF to LF, LF to CRLF, or either to CR. Open a UTF-8 file to count the endings it has now, then download the converted bytes. It runs in your browser.
Source text
Choose a UTF-8 file or paste your text below.
Editor text: the browser normalizes CRLF and CR to LF. Use a file to detect its original endings.
Result
Choose your options, then convert line endings.
Detected line endings in source
- LF
- —
- CRLF
- —
- CR
- —
Counts appear after conversion. CRLF counts once, separately from LF and CR.
⟦LF⟧, ⟦CRLF⟧, ⟦CR⟧ and ⟦BOM⟧ visualize invisible characters. These added markers are never copied or downloaded. Unicode line and paragraph separators display as line breaks here. Copy text and Download UTF-8 preserve those original characters.
No result yet.
Download preserves exact line-ending bytes. The plain textarea preview normalizes CRLF and CR to LF; your clipboard or receiving application may normalize endings too.
How to convert CRLF to LF
- Add your input
Paste text or open a UTF-8 file. Original file bytes remain the source until you edit or select Use editor text.
- Choose your options
Choose LF, CRLF or CR, then final newline and BOM rules. Defaults preserve trailing blank lines and the BOM.
- Convert and use the result
Inspect counts and markers, then copy or download. Convert again starts from the same source; Reset clears everything.
For LF to CRLF, pick CRLF (Windows) in step 2 instead. The other steps are the same.
Example: a file with mixed endings
Mixed-ending example loads four lines that start with a BOM and end with CRLF, LF, CR and CRLF. The counts show LF 1, CRLF 2 and CR 1. With the defaults, LF (Unix), Keep as is and Preserve existing, the output has 4 LF endings, keeps the BOM and still ends with a newline. The file downloads as text-lf.txt.
Shell scripts and most Linux and macOS tools expect LF, and a script saved with CRLF can fail to run. Some Windows programs, such as Notepad before 2018, expect CRLF. CR alone was used by Mac OS 9 and earlier.
Files stay on your device
File reading, decoding and conversion run in your browser. This tool does not upload, log or persist your text or file. Copy and download happen only when you select them.
Common questions
Are my files uploaded?
File reading, decoding and conversion run in your browser. This tool does not upload, log or persist your text or file. Copy and download happen only when you select them.
What is the difference between CRLF and LF?
Both mark the end of a line. LF is one byte, 0A, used by Linux and macOS. CRLF is two bytes, 0D 0A, used by Windows. The text looks the same in most editors, but tools that expect one type can misread the other, for example by leaving a stray CR at the end of each line.
Can this replace dos2unix or unix2dos?
For a UTF-8 text file, yes: LF (Unix) does what dos2unix does to line endings, and CRLF (Windows) does what unix2dos does. It handles one file at a time, and it stops with an error on a file that is not valid UTF-8 instead of guessing.
Which characters change?
Only CR (U+000D), LF (U+000A), optional final endings and the first leading BOM (U+FEFF) change. CRLF is one paired ending. Letters, spaces, tabs, emoji, combining marks, Unicode line/paragraph separators and other characters stay unchanged. Removal of trailing endings does not trim spaces.
What do final newline and BOM mean?
Keep converts the existing endings without adding or removing any. Add if missing appends one target ending only if there is no final CR or LF. Remove all trailing endings also removes empty lines at the end. A BOM is the optional UTF-8 prefix EF BB BF: preserve keeps it, add inserts it only when absent, and remove strips the first leading marker. Interior U+FEFF characters remain content.
Why do pasted text and file counts differ?
Browser textareas normalize CRLF and CR to LF. Clipboard software may also normalize before pasting. For original counts, open a UTF-8 file. Editing its displayed text or selecting Use editor text switches to that normalized text. Choose Download UTF-8 when exact bytes matter.
What files and sizes are supported?
Input must be valid UTF-8 regardless of extension or MIME type; malformed bytes produce an error instead of replacement characters. Empty files are valid. Other encodings need conversion to UTF-8 first. There is no fixed size cap; browser memory and string capacity limit processing. Cancel stops processing and preserves your input. This is a plain-text tool, not a rich-document converter.