Line Break Converter

Convert line endings between Windows (CRLF), Unix (LF), and Mac (CR) formats instantly. Standardise mixed line breaks, remove carriage returns, and prepare text for any system. No signup, no uploads — everything runs right in your browser.

Input & Options

Paste text and choose the target format
Tip: The tool normalises every line ending to your chosen format. Even mixed CRLF, LF, and CR inputs are unified.
Target formatChoose output line endings
Options

Converted Output

Results

Your converted text will appear here

Paste some text, choose a target format, then click Convert Line Breaks.

What does the Line Break Converter do?

Different operating systems use different invisible characters to mark the end of a line in text files. This line break converter standardises them to the format you choose, so the same file behaves correctly on every system — Windows, Linux, macOS, or any server you drop it on.

The tool understands all three conventions:

  • Windows (CRLF): \r\n — the standard for Windows text files.
  • Unix (LF): \n — used by Linux, macOS, Docker containers, and most modern systems.
  • Mac (CR): \r — classic Mac OS style, still found in some legacy files.

If your input contains a mix of all three — which happens often when files move between systems — the tool unifies every line ending to the format you select. It also detects and displays a live count of each type so you can see exactly what your input uses.

Everything runs locally in your browser using JavaScript. Your text never leaves your device — there is no server processing, no logging, and no data storage.

How to convert line breaks — step by step

  1. Paste your text: Drop text with the line endings you want to change into the input box. Any mix of CRLF, LF, and CR is supported.
  2. Check the detection badges: The tool instantly shows how many CRLF, LF, and CR line endings your input contains — useful for confirming what you're about to convert.
  3. Pick the target format: Choose Unix (LF) for Linux/macOS/Docker, Windows (CRLF) for Windows text files, or Mac (CR) for legacy files.
  4. Set options: Optionally trim trailing spaces before each line break, ensure a final newline, remove empty lines, or collapse consecutive blank lines.
  5. Click Convert Line Breaks: The tool normalises every line ending to your chosen format and shows the result instantly.
  6. Copy or download: Use the Copy Output button or download the result as a .txt file ready for any system.

Shortcut: Press Ctrl + Enter (or Cmd + Enter on Mac) inside the input box to convert instantly.

Line ending reference

FormatCharactersNameUsed by
Windows\r\n (CR+LF, 0x0D 0x0A)CRLFWindows, DOS, many text editors on Windows, HTTP headers
Unix\n (LF, 0x0A)LFLinux, macOS (10+), BSD, Docker, most servers, git default on macOS/Linux
Mac (classic)\r (CR, 0x0D)CRClassic Mac OS (pre-OS X), some legacy text files, old documents

Common use cases

Cross-platform file sharing

  • Convert Windows text files to LF before uploading to a Linux server or deploying via CI/CD.
  • Convert Unix files to CRLF so Windows-only tools like Notepad display them correctly.
  • Standardise mixed line endings from a repository before pushing to git.

Shell scripts and configuration files

  • Fix the infamous ^M error in shell scripts by converting CRLF to LF.
  • Prepare Dockerfiles, YAML, and shell scripts for Linux deployment.
  • Clean up config files that were edited on Windows and then moved to a Unix server.

Development workflow

  • Ensure consistent line endings across a team working on mixed operating systems.
  • Standardise files before running a diff so git doesn't show spurious changes.
  • Prepare source files for linting or code style checks that expect a specific line ending.

Legacy data and documents

  • Read old Mac OS text files that use CR line endings and convert them to LF.
  • Clean up exports from legacy systems that mix CR and LF.
  • Standardise data dumps before analysis.

Why use this Line Break Converter?

Instant conversion

Results appear the moment you click Convert. No server round-trip, no queue, no waiting.

Handles mixed line endings

If your text contains a mix of CRLF, LF, and CR, the tool unifies them all to your chosen format in one pass.

Live detection

See exactly how many CRLF, LF, and CR line endings your input contains before you convert.

100% private

Everything runs in your browser. The text you paste never leaves your device — no server, no logs, no tracking.

Copy or download

Copy the converted text to your clipboard, or download it as a .txt file with the new line endings already applied.

Works on mobile

Fully responsive. Convert line endings from a phone, tablet, or desktop — no app install required.

Tips and best practices

  • Check the detection badges first. If your input has a lot of CR characters and you only want LF, you can see at a glance what you're about to strip.
  • Use Unix (LF) for anything headed to a server. Linux, macOS, Docker, and most CI/CD pipelines expect LF. Converting CRLF to LF is the single most common use of this tool.
  • Use Windows (CRLF) for files that will only ever be opened in Notepad on Windows. Modern editors handle LF fine, but legacy Windows tools still expect CRLF.
  • Trim trailing spaces if your source has them. Trailing whitespace before line breaks is a common cause of noisy git diffs. The option fixes that in one pass.
  • Ensure final newline for POSIX compliance. Many Unix tools (including git and diff) expect the last line to end with a newline. Enable this option if you're preparing files for a Unix environment.
  • Don't convert binary files. This tool works on text. Converting the line endings of a PNG, ZIP, or PDF will corrupt it.
  • Pair with Text Statistics. Need to see a full breakdown of your text, including how many of each line break type it has? Use our Text Statistics tool.

Related tools you might need

Privacy, accuracy, and limits

Privacy: Nothing you paste into this converter is sent to a server. The whole conversion is JavaScript that runs entirely in your browser tab. There is no upload, no queue, no analytics event that includes your text, and no server-side log.

Accuracy: The tool uses a precise character-level scan to detect CRLF, LF, and CR. It correctly handles files with mixed line endings and normalises them all to your chosen format. The trim and final-newline options are applied after conversion, so results are always consistent.

Limits: There is no hard limit on input size. Since everything runs in-browser, the practical limit is your device's memory. Text files of several megabytes process in well under a second.

Frequently asked questions

A line break converter is a tool that changes the invisible characters that mark the end of a line in text files. Different operating systems use different conventions — Windows uses CRLF, Unix uses LF, and old Mac OS used CR. This tool converts between them.
CRLF (Carriage Return + Line Feed) is Windows standard — two characters, \r\n. LF (Line Feed) is Unix, Linux, macOS, and modern systems standard — one character, \n. CR (Carriage Return) was used by classic Mac OS before OS X — one character, \r.
Wrong line endings can break shell scripts, cause configuration files to be misread, make git diffs noisy, and create the infamous '^M' character in Unix output. Standardising them prevents cross-platform issues.
Yes. If your text contains a mix of CRLF, LF, and CR, the tool unifies every line ending to the format you choose. It also detects and displays what line endings your input currently uses.
No. Everything runs in your browser using JavaScript. The text you paste never leaves your device.
Paste the file contents into the input box and set the output format to Unix (LF). The tool will strip every CR character, leaving only LF line endings — which is what you want for files that need to run on Linux or macOS.
Yes, completely free. No signup, no watermark, no hidden charges. Convert as much text as you want.
Yes. Once the page loads, the converter works without an internet connection. All processing happens locally in your browser.
Yes. Click the download button to save the output as a .txt file with the new line endings already applied.
Cross-platform file sharing, git pre-commit hooks, fixing '^M' errors in shell scripts, preparing Dockerfiles and shell scripts for Linux deployment, and reading legacy Mac OS text files.