Normalize Line Breaks

Fix mixed line endings. Convert text or code files to consistent LF (Unix), CRLF (Windows), or CR (Mac) format.

3 lines (approx)
Converted to LF

Configuration

Detected Endings
LF
1
CRLF
1
CR
1

What is Normalize Line Breaks?

The Normalize Line Breaks tool addresses the subtle but annoying differences in how operating systems define a "new line". Windows uses two characters (Carriage Return + Line Feed), wheres Unix-based systems (Linux, macOS) use just one (Line Feed). This tool acts as a universal translator, standardizing your text to a single format to prevent compatibility issues. If you simply need to remove breaks entirely, try our Remove Line Breaks tool.

Why Normalization Matters

Script Execution

Bash scripts (`.sh`) created on Windows will fail on Linux with "command not found" errors unless normalized to LF.

Version Control

Prevents Git "phantom changes" where a file looks identical but deeply changed because every line ending was swapped.

CSV Parsing

Ensures data files are parsed correctly by tools that expect a specific line ending format.

Example: Fixing Mixed Line Endings

Input (Mixed)
Line 1[CR][LF](Windows)
Line 2[LF](Unix)
Line 3[CR](Mac)
Output (Normalized to Unix)
Line 1[LF]
Line 2[LF]
Line 3[LF]

Supported Formats

Unix (LF)

The modern standard. Used by Linux, macOS (OS X+), Android, and most web servers.

Windows (CRLF)

The DOS/Windows standard. Essential for compatibility with Windows-specific software.

Classic Mac (CR)

Legacy support for files from pre-2001 Apple systems.

Mixed Detection

Instantly alerts you if a file contains inconsistent line endings.

Secure Processing

Your code stays private. Everything runs in your browser.

File I/O

Upload scripts, verify their consistency, and download the fixed version.

How to Use

  1. Paste or Upload: Input the text or file you suspect has line ending issues.
  2. Check Stats: The dashboard will show if "Mixed Line Endings" are detected.
  3. Select Target: Choose your desired format (usually Unix LF).
  4. Export: Click 'Copy' or 'Save' to get the normalized file.

Frequently Asked Questions

What is the difference between LF and CRLF?

LF (Line Feed) is the standard newline character on Linux and macOS. CRLF (Carriage Return + Line Feed) is the standard on Windows. They represent the same concept (a new line) but use different invisible characters.

Why do I see '^M' characters in my file?

The ^M symbol represents a Carriage Return (CR) character. It usually appears when you open a Windows-formatted file (CRLF) in a text editor that expects Unix-formatted files (LF).

What are 'mixed line endings'?

This occurs when a single file contains both Windows (CRLF) and Unix (LF) line breaks. This often happens when multiple developers on different OSs edit the same file, leading to Git conflicts.

How do I fix 'bad interpreter' errors?

This error occurs when a shell script has Windows line endings. Use this tool to convert the file to 'Unix (LF)' format to fix it instantly.

Does this tool support Mac (CR) format?

Yes. While rare, we support the Classic Mac (CR) format used by Apple computers before macOS X (pre-2001).

Can I check a file without changing it?

Yes, just upload your file. The 'Detected Endings' dashboard will show you exactly how many LF, CRLF, and CR characters are present.

Is my code secure?

Absolutely. All processing is done locally in your browser. We never see or upload your scripts.

Which format should I use for Git?

For most modern projects, 'Unix (LF)' is the recommended standard. You can configure Git to handle conversions automatically, but normalizing files to LF manually is a good practice.

Can I upload Python or JS files?

Yes, you can upload any text-based code file (.js, .py, .sh, .json, .md) to check and fix line endings.

How do I know if my file is fixed?

After conversion, download the result or copy it. The dashboard for the input text detects current state; the output text is guaranteed to use only the format you selected.