Line Ending Converter — CRLF to LF Online | GadgetSurge

Convert CRLF, LF, or CR line endings. Detect mixed endings and UTF-8 BOM. Download fixed files — processing runs entirely in your browser.

About Line Ending Converter

Text files store line breaks differently: CRLF (\r\n) on Windows, LF (\n) on Unix and modern macOS, and CR (\r) on classic Mac OS. Mixing styles in one repository makes diffs show every line as changed even when content is identical.

Shell scripts edited on Windows often fail on Linux with /bin/bash^M: bad interpreter or \r': command not found because the carriage return sits before the newline in the shebang line.

Git can normalize endings with core.autocrlf and .gitattributes — for example * text=auto and *.sh text eol=lf force shell scripts to LF on checkout regardless of OS.

A UTF-8 BOM (byte order mark) at the start of a file can break shebang lines and confuse some CSV or JSON parsers that expect the first character to be # or {.

This tool normalizes by converting all \r\n and \r to \n first, then applies your target ending. Processing runs in your browser; downloads contain the real bytes even though the preview hides line endings.

How to Use Line Ending Converter

  1. Paste text or upload a file — the detector counts CRLF, LF-only, and CR-only lines.
  2. Choose LF (Unix/macOS), CRLF (Windows), or CR (classic Mac) as the target.
  3. Enable Remove BOM (default) and optionally ensure a trailing newline.
  4. Click Convert, preview the text, then Download — uploaded files keep their original name.

Common Use Cases

Frequently Asked Questions

What is CRLF vs LF?

CRLF is carriage return + line feed (\r\n), used on Windows. LF is line feed only (\n), used on Unix and macOS.

Why does bash show ^M?

The CR character remains in the file. Convert to LF so the shebang line is #!/bin/bash with no extra carriage return.

What is a UTF-8 BOM?

An invisible U+FEFF prefix at the start of a UTF-8 file. It can break scripts and parsers; this tool can strip it on convert.

Why does git show every line changed?

Mixed or flipped line endings change bytes on every line. Normalize endings to fix noisy diffs.

Can I see endings in the preview?

No — line endings are invisible in the textarea. Trust the download for exact bytes.

What filename is used?

Uploaded files keep their name; pasted text downloads as converted.txt.

How is conversion done?

All input is normalized to LF internally, then rewritten as LF, CRLF, or CR.

Is file content uploaded?

No. FileReader and conversion run locally in your browser.