Newline Converter

Detect a file's line-ending style and convert between Unix (LF), Windows (CRLF), and classic Mac (CR) formats without touching any other character.

runs locally on your browser. Your data never leaves your device.

Output Format

No line breaks
0Lines
0CRLF Found
0LF Found
0CR Found

Common Use Cases

Fix a shell script's "bad interpreter" error caused by Windows-style CRLF endings hiding in the shebang line
Normalize a file assembled from multiple pasted sources that ended up with two or three different line-ending styles mixed together
Convert a Unix-style text file to Windows CRLF format before opening it in an older Windows application that expects it
Clean up a file's line endings before committing it to git, so the diff shows only the lines that actually changed

About Newline Converter

Every plain text file ends each line with one or more invisible control characters, and which ones it uses depends on the operating system that created it. Unix, Linux, and modern macOS use a single line feed character (LF, \n). Windows uses a carriage return followed by a line feed (CRLF, \r\n), a convention inherited from old teletype hardware where the carriage genuinely had to return to the left margin before advancing to the next line. Classic Mac OS, before OS X, used a lone carriage return (CR, \r) with no line feed at all. All three conventions look identical on screen as an ordinary line break, so a text editor rarely tells you which one a given file is actually using.

That invisibility is exactly what makes mismatched line endings such a persistent source of trouble. A shell script saved with Windows-style CRLF endings and then run on Linux or inside a Docker container fails with a cryptic "bad interpreter" error, because the shebang line's interpreter path ends in an invisible \r that the kernel treats as part of the filename. A file re-saved by an editor that silently normalizes line endings shows every single line as changed in a git diff, burying the one real edit under thousands of false ones and making code review effectively useless. Some parsers, CSV importers, and older APIs choke outright on line endings they don't expect, or silently split records in the wrong place. A file assembled by copying sections from multiple sources can end up with two or even three line-ending styles mixed together, which is often the hardest version of this problem to notice by eye.

This tool solves both halves of that problem: it tells you what you're looking at, and then it fixes it. Paste or type text into the input panel, and it's scanned immediately, counting exactly how many CRLF pairs, lone LF characters, and lone CR characters are present. A badge next to the Input label reports the result in plain language: Unix (LF) detected, Windows (CRLF) detected, Classic Mac (CR) detected, Mixed line endings when more than one style is present in the same text, or No line breaks when the text is a single line. A row of stats beneath the panels breaks the same counts out individually, so a file with mixed endings shows exactly how many of each type it contains rather than only flagging that a mix exists. Pick a target format with the Unix, Windows, or Classic Mac segmented control above the input, and the output panel updates instantly, with a one-click copy button to grab the result.

The conversion itself only ever touches line-ending characters. Every CRLF pair and every lone CR is first normalized down to a plain LF, and that normalized text is then expanded into whatever target format you chose, so mixed input converts just as cleanly as input that's already consistent. No word, space, tab, or any other character in your text is inspected, reordered, or altered in the process, and nothing you paste here is ever uploaded, logged, or transmitted anywhere. Every character is scanned and every conversion performed by plain JavaScript running directly in your browser, which matters because the files people run this on, scripts, configuration files, source code, are often exactly the kind of thing that shouldn't leave their machine.

Frequently Asked Questions

What's the actual difference between LF, CRLF, and CR?
LF (line feed, \n) is a single character used by Unix, Linux, and modern macOS to end a line. CRLF (carriage return plus line feed, \r\n) is two characters used by Windows. CR (carriage return alone, \r) was used by classic Mac OS before OS X and is rarely produced by anything today. All three render as an ordinary line break on screen, so a plain text editor usually can't show you which one a file actually uses.
How does this tool detect which line-ending style my text uses?
It counts every CRLF pair, then counts whatever lone carriage returns and lone line feeds remain once those pairs are removed. If only one of the three counts is nonzero, that's the detected format. If two or three are nonzero at once, the text is reported as having mixed line endings, and the exact count of each type is shown in the stats row so you can see precisely how mixed it is.
What happens if my pasted text has mixed line endings?
The badge reports "Mixed line endings" and the stats row shows the individual CRLF, LF, and CR counts found in the original text. Conversion still works normally: every line ending, regardless of which style it originally was, is normalized to a plain LF first and then converted to whichever output format you've selected, so the result always ends up fully consistent.
Will converting line endings change anything else in my text?
No. The conversion only replaces line-ending characters, CRLF, lone CR, and lone LF, with your chosen target format. Every word, space, tab, and any other character is passed through completely unchanged, in the exact order it appeared in the input.
Why do line endings matter for git and version control?
If a file's line endings change from what's already committed, even with no other edit, git sees every single line as modified, since the line-ending character is technically part of each line. This buries genuine changes in noise and makes a diff or code review nearly impossible to read. Converting a file to a consistent line-ending style before committing it, and keeping that style consistent afterward, avoids this entirely.
Is my text uploaded, logged, or stored anywhere?
No. Detection and conversion both happen with plain JavaScript running locally in your browser. Nothing you paste into this tool is ever sent to a server, logged, or saved, which matters since the files people convert here are often scripts, configuration files, or source code they don't want leaving their machine.