# Line Ending Converter

Convert text line endings between LF (Unix/macOS), CRLF (Windows), and CR (classic Mac). Normalizes mixed endings in one pass and reports the original breakdown.

> Canonical page: https://elysiatools.com/en/tools/line-ending-converter

- **Category:** Text Processing

- **Keywords:** line ending converter, lf to crlf, crlf to lf, newline converter, eol converter, normalize line endings

## Overview

Convert the line endings of any text between the three conventions in use today — **LF**, **CRLF**, and **CR** — while leaving every line's content untouched.

**The three conventions:**
- **LF** (`\n`) — Unix, Linux, modern macOS, and the web's default. The modern common ground.
- **CRLF** (`\r\n`) — Windows and classic network protocols (HTTP, SMTP, etc.).
- **CR** (`\r`) — classic (pre-OS X) Mac OS. Rare today, but still appears in legacy data and certain hardware logs.

**How it works:**
- The tool first detects whatever mix of endings your input already has (including a mix of all three in one file, common after pasting from different sources).
- It splits the text into logical lines, then rejoins them using your chosen ending.
- The final line is given an ending too, so the whole block is uniform end-to-end.

**Good to know:**
- This normalizes mixed endings — if a file has both `\n` and `\r\n` lines (a frequent source of Git "mixed line endings" warnings), converting it to one ending fixes that in one step.
- Line *content* (trailing spaces, tabs) is preserved; only the line terminator changes.
- The metadata reports the original ending breakdown (how many CRLF / LF / CR), so you can see exactly what you started with.

## Inputs

- **Text** (textarea): Paste text with any mix of line endings (LF, CRLF, CR)...
- **Convert to** (select)

## When to use

- When resolving Git 'mixed line endings' warnings or formatting issues in cross-platform codebases.
- When preparing configuration files, scripts, or CSV data for systems that strictly require LF or CRLF line endings.
- When cleaning up text pasted from multiple sources that contains a mix of different newline characters.

## How it works

- Paste your text into the input area and select your target line ending format (LF, CRLF, or CR).
- The tool analyzes the input to detect and count the existing line endings (LF, CRLF, and CR).
- The text is split into individual lines and reconstructed using only the selected target line ending, ensuring the final line is also terminated.

## Use cases

- Converting Windows-generated CRLF scripts to LF before running them on a Linux server to prevent execution errors.
- Standardizing mixed line endings in source code files before committing changes to a shared Git repository.
- Formatting raw log files or CSV exports that contain inconsistent line terminators from legacy hardware.

## Frequently asked questions

### What is the difference between LF and CRLF?

LF (\n) is the standard line ending for Unix, Linux, and modern macOS, while CRLF (\r\n) is used by Windows and classic network protocols.

### Will this tool modify the actual text content of my lines?

No, the tool only modifies the line terminators (newlines) and preserves all other characters, including trailing spaces and tabs.

### Can this tool fix files with mixed line endings?

Yes, it detects all mixed endings (LF, CRLF, and CR) in a single input and normalizes them to your chosen target format.

### What is CR line ending used for?

CR (\r) was used by classic Mac OS (pre-OS X) and is occasionally found in legacy systems or specific hardware logs.

### Does the tool add a trailing newline to the final line?

Yes, it ensures the final line is terminated with the selected line ending to maintain document uniformity.

## Related tools

- [Advanced Case Converter](https://elysiatools.com/en/tools/advanced-case-converter): Convert between CamelCase, snake_case, kebab-case, PascalCase, and other naming conventions
- [ASCII Art Generator](https://elysiatools.com/en/tools/ascii-art-generator): Convert text to ASCII art using various fonts and styles
- [Indented List to ASCII Tree](https://elysiatools.com/en/tools/ascii-tree-from-indented-list): Convert a 2-space / 4-space / Tab indented hierarchical list (Markdown bullets, -, *, 1. prefixes optional) into a copyable ASCII directory tree. Two styles: Unicode box-drawing (├──└──│) for GitHub/Discord and classic ASCII (|--\--|) for plain text. Toggles for full guide lines, trailing spaces, and bracketed leaf nodes like docs/\[api.md\].
- [Bold & Italic Text](https://elysiatools.com/en/tools/bold-italic-text): Convert text to bold, italic, or bold-italic using the Mathematical Alphanumeric Symbols Unicode block. Plain Unicode text — no font needed.
- [Even Line Extractor](https://elysiatools.com/en/tools/even-line-extractor): Extract even-numbered lines from text content with support for various indexing methods and custom criteria
- [Fullwidth to Halfwidth Converter](https://elysiatools.com/en/tools/fullwidth-to-halfwidth): Convert fullwidth characters to halfwidth characters for proper text formatting
- [Halfwidth to Fullwidth Converter](https://elysiatools.com/en/tools/halfwidth-to-fullwidth): Convert halfwidth characters to fullwidth characters for CJK text formatting
- [Leet Speak Converter](https://elysiatools.com/en/tools/leet-speak-converter): Convert text to and from leet speak (1337). Encode with Basic, Full, or Caps styles, or decode leet back to plain text.

## Samples

- [Duplicate Line Samples](https://elysiatools.com/en/samples/text-duplicate-line-samples): Sample files with various types of duplicate lines for testing duplicate removal tools
- [Copyright-Free MP3 Audio Samples](https://elysiatools.com/en/samples/mp3-samples): Collection of royalty-free audio samples for testing and development purposes including nature sounds, meditation music, and ambient audio
- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion

## Related content

- [Text Case, Encoding, and Normalization Conversion Tools](https://elysiatools.com/en/hubs/text-convert): Compare text case conversion, character-width conversion, encoding conversion, quoted-printable handling, and inline text normalization tools in one hub.
- [Text Tools](https://elysiatools.com/en/hubs/text-utility): Explore 33 text tools for utility workflows and compare closely related utilities quickly.
- [Text Analysis, Readability, and Content Inspection Tools](https://elysiatools.com/en/hubs/text-analyze): Compare text statistics, language detection, readability scoring, sentiment analysis, moderation review, and pattern analysis tools in one hub.
- [Text Redaction, Highlighting, and Presentation Formatting Tools](https://elysiatools.com/en/hubs/text-format): Compare tools for masking sensitive text, finding PII, normalizing phone numbers, highlighting phrases, centering text, and formatting diffs in one hub.
