Use Line Ending Converter

Enter your data below to use the Line Ending Converter

📌 Try these examples:
RESULT

Last updated

Detecting Line Endings in a File

Before converting, the tool detects what line endings your text currently uses:

Input text analysis:
─────────────────────────────────────────
Line ending type: Windows CRLF (\r\n)
Total lines: 45
Total CRLF sequences: 44
Total LF-only sequences: 0
Total CR-only sequences: 0

Recommendation: Convert to LF for Linux/Mac deployment

This detection is especially useful when you receive a file and aren't sure what format it's in before processing it.

Converting Windows CRLF to Unix LF

The most common conversion — preparing a file edited on Windows for deployment on a Linux server:

Input (Windows format, showing invisible characters):
line one\r\n
line two\r\n
line three\r\n

Settings: Convert CRLF → LF

Output (Unix format):
line one\n
line two\n
line three\n

Changes made:
- 3 CRLF sequences converted to LF
- File size reduced by 3 bytes (one \r removed per line)

This is critical for shell scripts, Python files, and configuration files that will run on Linux servers.

Fixing a Shell Script That Fails on Linux

A bash script edited on Windows fails with cryptic errors on Linux. The issue is CRLF line endings:

Error on Linux:
bash: $'\r': command not found
bash: syntax error near unexpected token `$'\r''

Cause: The \r character is being interpreted as part of the command name.

Fix: Convert the script from CRLF to LF

Before (CRLF):
#!/bin/bash\r\n
echo "Hello World"\r\n
cd /var/www\r\n

After (LF only):
#!/bin/bash\n
echo "Hello World"\n
cd /var/www\n

The script now runs correctly on Linux.

Converting Unix LF to Windows CRLF

When a file needs to be opened in Windows Notepad (which doesn't handle LF-only files well in older versions):

Input (Unix format):
line one\n
line two\n
line three\n

Settings: Convert LF → CRLF

Output (Windows format):
line one\r\n
line two\r\n
line three\r\n

Changes made:
- 3 LF sequences converted to CRLF
- File size increased by 3 bytes

Handling Mixed Line Endings

Files edited on multiple platforms can have mixed line endings — some lines with CRLF, others with LF:

Input analysis:
Line ending type: MIXED
  CRLF sequences: 12
  LF-only sequences: 8
  CR-only sequences: 0

This file has inconsistent line endings, likely edited on
both Windows and Unix systems.

Settings: Normalize to LF

Output:
All 20 line endings converted to LF.
File now has consistent Unix line endings.

Mixed line endings are a common cause of Git showing files as entirely modified even when only a few lines changed.

Converting Old Mac CR to Modern LF

Classic Mac OS (pre-OS X) used CR-only line endings. These files are rare but still encountered:

Input analysis:
Line ending type: Classic Mac CR (\r)
Total lines: 30
Total CR-only sequences: 29

Settings: Convert CR → LF

Output:
29 CR sequences converted to LF.
File now uses Unix/Linux line endings.

Nginx Configuration File Fix

An Nginx config file edited on Windows causes issues on the Linux server:

Before (CRLF — causes Nginx to misread directives):
server {\r\n
    listen 80;\r\n
    server_name example.com;\r\n
    root /var/www/html;\r\n
}\r\n

After converting to LF:
server {\n
    listen 80;\n
    server_name example.com;\n
    root /var/www/html;\n
}\n

Result: nginx -t now passes without errors.

Git Line Ending Troubleshooting

When Git shows a file as entirely modified despite no visible changes, line endings are usually the cause:

Git diff shows:
-line one\r
+line one
-line two\r
+line two

This means the file has CRLF endings but Git expects LF.

Fix options:
1. Convert the file to LF using the Line Ending Converter
2. Add a .gitattributes file:
   * text=auto
   *.sh text eol=lf
   *.bat text eol=crlf

After converting to LF and committing:
Git diff shows no changes — the file is clean.

CSV File Processing Fix

A CSV parser fails because the file has CRLF endings but the parser expects LF:

Error: CSV parser returning extra \r in field values
  Row 1, Field 3: "New York\r" (unexpected carriage return)

Cause: File has CRLF line endings; parser only strips \n

Fix: Convert CRLF to LF before processing

Before:
"Alice","30","New York"\r\n
"Bob","25","Chicago"\r\n

After (LF only):
"Alice","30","New York"\n
"Bob","25","Chicago"\n

Parser now reads field values correctly without trailing \r.

Conversion Statistics

The tool always shows a summary of what was changed:

Conversion Summary:
─────────────────────────────────────────
Input format:  Windows CRLF (\r\n)
Output format: Unix LF (\n)

Lines processed: 156
Line endings converted: 155
Characters removed: 155 (\r characters)

Input size:  8,432 bytes
Output size: 8,277 bytes
Size reduction: 155 bytes (1.8%)

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! Line Ending Converter is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.