← All Tools

Line Ending Converter

Convert text between CRLF (Windows), LF (Unix / modern macOS), and CR (classic Mac OS ≤ 9) line endings. Visualize the hidden newline bytes, detect mixed endings, and copy or download the result.

Input

Total bytes
0
Lines
0
CRLF
0
LF only
0
CR only
0
Mixed?

Convert to

LF \n
Unix, Linux, modern macOS, web, git default
CRLF \r\n
Windows, HTTP headers, SMTP, FTP ASCII mode
CR \r
Classic Mac OS (System 1–9), pre-OS X

Output

Output bytes
0
Size delta
0

Visualization

Hidden line ending bytes made visible. \r\n = CRLF, \n = LF, \r = CR. Trailing whitespace is marked with ·.

Cheatsheet

Which line ending should I use?
ContextUseBytes
Unix / Linux source files, shell scriptsLF0x0A
macOS (modern, OS X / 10+)LF0x0A
Git repos (default, recommended)LF0x0A
Windows Notepad, .bat, .cmdCRLF0x0D 0x0A
HTTP headers (RFC 7230)CRLF0x0D 0x0A
SMTP / IMAP / POP3 / FTP (control)CRLF0x0D 0x0A
CSV per RFC 4180 (canonical)CRLF0x0D 0x0A
Classic Mac OS (System 1–9)CR0x0D

Git auto-conversion: git config --global core.autocrlf input on Linux/macOS, true on Windows. Configure per-repo with .gitattributes: * text=auto eol=lf.

Command-line equivalents
  • Linux/macOS: dos2unix file.txt, unix2dos file.txt, tr -d '\r' < in.txt > out.txt
  • sed: sed -i 's/\r$//' file.txt (CRLF→LF), sed -i 's/$/\r/' file.txt (LF→CRLF)
  • PowerShell: (Get-Content file -Raw) -replace "`r`n","`n" | Set-Content file -NoNewline
  • VS Code: click CRLF/LF in the status bar (bottom right)