Skip to content
⏎

Line Ending Converter

Convert line endings between Windows CRLF, classic Mac CR, and Unix LF.

Runs in your browser

Updated

-

Converted

A textarea cannot display a carriage return, so the exact result is shown here with each ending spelled out.

Result with visible endings

-

What was found

CRLF pairs

0

Lone LF

0

Lone CR

0

Lines

0

Git has the same three settings, and a file with mixed endings will show every line as changed in a diff. Set core.autocrlf to input or add a .gitattributes with * text=auto eol=lf so this does not keep coming back.

Everything becomes LF first

Paste text, press Sample, or load a file, and the page keeps an untouched copy of it. Anything counted or converted is normalised first: each carriage return plus line feed pair collapses to one line feed, and any leftover lone carriage return follows. The Convert to menu then rebuilds one of three endings, with Unix (LF) preselected.

What the counters read

The counters read that original copy. CRLF pairs count the two-byte sequence, Lone CR counts a carriage return with no line feed after it, Lone LF the reverse, and Lines splits normalised text on line feeds, so a trailing newline counts as an extra line. The label beside the input reads, for example, Detected: CRLF + LF + CR.

A worked example

The sample loaded on open holds four lines carrying one CRLF pair, one lone LF and one lone CR, so the counters read 1, 1, 1 and 4, and the note calls out three mixed styles. On the Unix default the output is 45 characters. Windows (CRLF) writes 48, since each break gains a byte, while Classic Mac (CR) stays at 45.

The extra buttons

Strip trailing whitespace deletes spaces and tabs at each line end. Remove trailing newlines cuts breaks off the tail, and Add final newline appends one only when the text is not empty and lacks it. Copy takes the converted string, not the normalised one, and Download saves it as converted.txt.

Where it stops

  • A textarea cannot display a carriage return, so the input box shows the normalised version.
  • Download always names the file converted.txt with the text/plain type, whatever you loaded.
  • The file picker sets no size limit and reads files as UTF-8 text.

Questions people ask

Why does my diff show every line changed?

Both sides disagree on endings. Set core.autocrlf to input, or commit a .gitattributes rule reading * text=auto eol=lf.

Is the saved file the same as the preview?

Yes. The read-only box shows only line feeds, which is why the visible-endings panel spells each marker out.

Can it go straight from CRLF to CR?

It can, since conversion passes through LF. Compare results with the text diff checker and list what stays untracked in the gitignore generator.