Line Ending / BOM Converter Tool - Free Online CRLF LF CR Newline and UTF-8 BOM Converter

First Published:
Last Updated:

Convert text and text files between Windows (CRLF), Unix (LF), and classic Mac (CR) line endings, add or remove the UTF-8 BOM, detect mixed newlines with per-style ratios, normalize trailing newlines, and batch-process multiple files into a ZIP - all entirely in your browser.

All processing is performed entirely in your browser using client-side JavaScript. No data is transmitted to any server. Your text and files never leave your device.

  • This tool is provided "AS IS" without any warranties of any kind.
  • The author accepts no responsibility for data loss or unintended modifications.
  • Line ending conversion can subtly change file contents and downstream tooling behavior. Verify the result before overwriting source files.
  • The tool decodes input files as UTF-8. Files in other encodings (Shift_JIS, EUC-JP, UTF-16, etc.) should first be converted with a dedicated character-encoding converter.
  • Always keep backups of your original files.
  • By using this tool, you accept full responsibility for any outcomes.

This tool uses client-side JavaScript for all processing. No data is transmitted to servers, no files are uploaded online, and all processing happens locally in your browser. Once loaded, this tool continues to work even without an internet connection. For more details, please refer to our Web Tools Disclaimer.

Conversion Options

No input.
No output yet.
Drop text files here, or click / press Enter to browse Multiple files supported. All processing is local.

Features

  • 3-Way Line Ending Conversion: Convert text between CRLF (Windows), LF (Unix / Linux / macOS), and CR (Classic Mac OS) styles in any direction.
  • UTF-8 BOM Control: Add, remove, or preserve the UTF-8 byte order mark (EF BB BF / U+FEFF) independently from line endings.
  • Mixed Line Ending Detection: Counts CRLF, LF, and CR occurrences separately and shows per-style percentages, with a clear "MIXED" indicator when more than one style is present.
  • Trailing Newline Policy: Keep, ensure (POSIX-compliant), or strip the final newline of the output.
  • Blank Line Compression: Optionally collapse 2 or more consecutive blank lines into one.
  • Live Statistics: Per-input and per-output panels report BOM state, line endings, line count, byte size, and trailing-newline status.
  • Batch ZIP Download: Drag-and-drop multiple text files, convert with a single click, and download the result as a ZIP archive (filenames preserved).
  • Byte Delta Reporting: Each conversion shows the exact byte change so you can quickly verify the impact on file size.
  • Privacy-First: 100% client-side - no uploads, no telemetry, no third-party calls. Works offline once loaded.

How to Use

  1. Set Conversion Options: Choose the target line ending, BOM action, trailing newline policy, and whether to collapse blank lines. These options apply to both Text Mode and Batch Files Mode.
  2. Text Mode: Paste text in the input area on the left. The detection panel below it shows live BOM, line ending, line count, and byte information. Click Convert to produce the result on the right, then Copy Result or Download as File.
  3. Batch Files Mode: Drop one or more text files into the drop zone (or click to browse). Each file is read locally as UTF-8 and shown in a table with its detected line endings, BOM, and size. Click Convert All Files, then Download ZIP to receive an archive with the converted versions.
  4. Verify Result: The output detection panel and file table reflect what was actually produced - confirm the line ending and BOM state match expectations before saving over the originals.

About Line Endings and the UTF-8 BOM

  • CRLF (\r\n, 0D 0A): Default on Windows and used by many internet protocols (HTTP, SMTP, IMAP) per RFC 5322 / RFC 2822.
  • LF (\n, 0A): Default on Unix, Linux, and modern macOS. POSIX defines a "line" as a sequence of characters terminated by a newline (LF).
  • CR (\r, 0D): Used by Classic Mac OS through version 9. Modern macOS (Mac OS X / 10.x and later) uses LF.
  • UTF-8 BOM (EF BB BF, U+FEFF): An optional 3-byte marker at the very start of a UTF-8 encoded file. Useful for some Windows tools (Excel CSV imports, Notepad) but can break shell scripts, JSON parsers, and configuration files. The Unicode Standard does not require it for UTF-8.
  • Mixed line endings: A single file containing more than one style is a common cause of diff noise, broken Git history, scripting bugs, and unreadable text in editors that follow the file's first line ending.

Common Use Cases

  • Cross-platform development: Normalize files crossing between Windows, Linux, and macOS environments to a consistent newline style.
  • Git hygiene: Eliminate CRLF/LF churn in diffs and ensure files end with a trailing newline (a long-standing POSIX expectation).
  • CSV / data exchange: Add a UTF-8 BOM so Microsoft Excel correctly detects the encoding when opening UTF-8 CSV files, or strip the BOM for tools that mishandle it.
  • Shell / config files: Remove a stray UTF-8 BOM that causes "command not found" errors when bash reads the shebang line.
  • Editor migration: Convert legacy CR-only files (from old Mac apps) to LF for use in modern editors and version control.
  • Static site assets: Standardize the line endings of HTML, CSS, JS, JSON, and YAML files before deploying to S3 / CloudFront / GitHub Pages.

Important Notes

  • The tool decodes input bytes as UTF-8 (with BOM auto-detect). For Shift_JIS, EUC-JP, UTF-16, or other encodings, convert the file to UTF-8 first using a dedicated character-encoding converter.
  • Line ending conversion changes byte content. The reported byte delta lets you verify that the change is what you expected (for example, CRLF→LF on a 1000-line file should reduce size by ~1000 bytes).
  • "Trailing newline: Add" only adds a single LF (which is then re-emitted as the chosen target ending). It does not blank-pad the file.
  • Filenames in the downloaded ZIP are preserved as uploaded; duplicates are auto-suffixed with -2, -3, etc. The ZIP is built with no compression (STORE) for fast extraction of small text files.
  • Browser textareas may normalize newlines on display; the detection panel reflects what the browser actually stored, which is what the conversion operates on.
  • References: RFC 3629 (UTF-8), Unicode 15.0 Standard, Section 23.8 "Specials", WHATWG Encoding Standard.

Third-Party Libraries:


References:
Tech Blog with curated related content
Web Tools Collection

Written by Hidekazu Konishi