Free tool · Developer tools
Line endings converter
A line endings converter rewrites every line break in a text as LF, CRLF or CR. The 4 breaks in a four line sample become CRLF and the text grows from 46 to 50 bytes.
- Free
- No sign-up
- Runs in your browser
- 4 breaks now CRLF
- Endings found
- LF
- Before
- 4 LF
- After
- 4 CRLF
- Size in bytes
- 46 before, 50 after
- Lines
- 4
How to use the Line Endings Converter (CRLF LF)
- Paste text into Your text, or pick a file with Or open a text file to see its real endings.
- Choose the ending to convert to: LF, CRLF or CR.
- Decide what happens to the break at the very end of the text: keep it, make sure there is one, or remove it.
- Read the counts in the list, then use Copy or Download file.
What are LF, CRLF and CR line endings?
A line ending is the character or pair of characters that marks where one line stops and the next begins. LF is a single line feed, character 10, written as \n. CRLF is a carriage return followed by a line feed, characters 13 and 10, written as \r\n. CR is a lone carriage return, character 13, written as \r. The three forms look the same in an editor that handles them all, but they are different bytes in the file.
The extra byte is why file sizes change. Here is the same four line sample in each form. The size column counts UTF-8 bytes, so CRLF adds one byte per break and the other two forms add none.
| Ending | Written as | Breaks | Size in bytes |
|---|---|---|---|
| LF | \n | 4 | 46 |
| CRLF | \r\n | 4 | 50 |
| CR | \r | 4 | 46 |
How do you convert CRLF to LF?
Paste the text, or open the file, and choose LF. Every CRLF pair, every lone CR and every LF is rewritten as a single LF. The page reads the text in one pass and treats a CRLF pair as one break, so it never turns one break into two. Choose CRLF to go the other way: every break becomes the two byte pair.
Mixed endings are the usual reason to run a converter. The test file for this page has 2 CRLF breaks, 1 LF break and 1 CR break in 5 lines. It is 40 bytes as it stands, 38 bytes after conversion to LF and 42 bytes after conversion to CRLF. The list under the result shows the count of each kind before and after, so you can see that the result is uniform.
Opening a file matters when you want to inspect endings. A browser text box turns every break into LF as soon as you paste, so pasted text always reads as LF. The file picker reads the bytes as they are, and the result panel marks each break as [LF], [CRLF] or [CR].
The picker reads the file as bytes and looks for a byte order mark. A UTF-8 file with a BOM keeps its three BOM bytes, a UTF-16 file with a BOM is read in its own byte order and saved back that way, and a file that is not valid UTF-8 is treated as Latin-1 so each byte survives unchanged. Other encodings, such as Shift JIS or Windows-1251, are not detected and would be read as Latin-1. A file longer than 200,000 characters is shown only in part, and the box turns read-only so the download still holds the whole file.
What happens to the last line break?
Many tools expect a text file to finish with a break, and many diff views flag a missing one. The three choices cover both cases. Keep as is leaves the end alone. Make sure there is one adds a single break in the chosen ending when the text does not finish with one. Remove it deletes every break at the end.
A short check: the text a\nb becomes a\r\nb\r\n with CRLF and the add option, while a\nb\n\n becomes a\nb with LF and the remove option. An empty text stays empty under every option.
What does version control do with line endings?
Git can convert line endings by itself. Its attributes page says that setting the text attribute normalizes line endings to LF when files are added, and that the eol attribute decides what a checkout writes: eol=crlf for CRLF and eol=lf for LF. If neither is set, the core.autocrlf setting applies. A converter is useful for files that were saved with the wrong ending before such rules were in place, or for a single file that has to match a tool that reads only one form.
The converter changes only line breaks. Tabs, spaces, accents and emoji stay as they are, and the page does not strip trailing spaces. The Unicode line and paragraph separators, and the old NEL character, are not treated as breaks.
Use it with
- Remove Duplicate Lines: clean lists of repeated lines.
- Regex Tester: test regex with highlights.
- Sort Lines Alphabetically: sort lists A–Z, Z–A, by length.
Questions
How do I change CRLF to LF?
Paste the text or open the file, pick LF and copy or download the result. Each CRLF pair becomes one LF, so the mixed test file drops from 40 to 38 bytes.
Why does pasted text always show LF?
A browser text box normalizes line breaks to LF when text goes in. Open the file with the file picker to read its endings exactly as they are stored.
Does CRLF make a file bigger?
Yes, by one byte per break. The four line sample is 46 bytes with LF and 50 bytes with CRLF.
What is a lone CR?
A carriage return with no line feed after it. The page counts it as its own kind of break and rewrites it like the others.
Does the download keep the BOM and the encoding?
Yes for UTF-8 with or without a BOM, UTF-16 with a BOM and Latin-1. The file is read as bytes and written back in the same form, with only the line breaks changed.
Can the page convert a very large file?
It reads text up to 5 million characters. Beyond that it asks you to split the file, so the tab stays responsive.
Is my text sent anywhere?
No. The page rewrites the breaks with your own browser and keeps no copy, so a file you open never travels over the network.
The tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations are checked against the tool's own output.