Line Ending Converter

Lines—
Line endings found—
Output ending—

How Line Ending Converter is calculated: Line endings: CRLF is carriage return plus line feed (Windows), LF is line feed alone (Unix and modern Mac), CR is carriage return alone (old Mac). Convert by normalising to LF first, then joining with the target ending.

What is a Line Ending Converter?

A line ending converter is a free online tool that converts text between CRLF, LF and CR line endings and counts the endings it found. It takes the text or values you paste in, works on them in your browser, and shows the result at once, with no sign-up, no upload, and no waiting for a server to reply.

People reach for a line ending converter when they need a quick, reliable answer and do not want to install software or open a heavy desktop program for a small job. Students use it to check their work, developers use it while building and testing, and writers and site owners use it to tidy up content before it goes live. The job is usually small, but getting it wrong wastes far more time than doing it right.

Everything on this page runs in your browser. Nothing you paste is sent to a server, stored, or shared, which matters when the input is a config file, a draft, or a piece of text you would rather keep private. The tool works offline once the page has loaded, and it costs nothing to use, as many times as you like.

How a Line Ending Converter works

The Line Ending Converter works in a few clear steps. First, it counts the line endings already in the text: CRLF pairs, lone LF characters, and lone CR characters. Then it normalises the whole text to LF, which is the simplest ending, by turning every CRLF and every lone CR into an LF. Then it joins the lines back together with the ending you picked: CRLF for Windows, LF for Unix, or CR for old Mac files. The result appears in the output box and in the summary rows above it, so you can read the answer and copy the full output in one place. There is no hidden step and no guesswork: the same input always gives the same output.

The method behind it is the standard one for this kind of job, not a shortcut invented for this page. The rule is the standard one for this kind of job, published and widely used, so the answer agrees with any other correct tool that follows the same rule. That matters because a tool that follows the standard rule gives answers you can check against any other correct tool, a textbook, or a reference table. When two honest tools disagree, one of them is using a different rule, and this page names its rule plainly so you can see which one it is. A related check, the JSON formatter, covers the neighbouring job.

The formula and the rule are shown in the box near the top of the page. Line endings: CRLF is carriage return plus line feed (Windows), LF is line feed alone (Unix and modern Mac), CR is carriage return alone (old Mac). Convert by normalising to LF first, then joining with the target ending. If you paste the default example and read the output, you can follow the rule by hand and see that the page agrees with it. That hand-check is the fastest way to trust a tool: run one example you can work out yourself, and check that the tool gives the same answer.

The text with mixed line endings explained

The input people get wrong most often is the text with mixed line endings. Paste any text. The tool reads the endings as they are: a file edited on Windows and then on a Mac often has a mix of CRLF and LF, which is exactly the problem this tool fixes. The visible text does not change at all, only the invisible characters at the end of each line. If the input is not in the shape the tool expects, the output will be wrong in a way that looks right, which is worse than an error message. Read the label above the box, look at the default example, and match its shape before you paste your own data in.

A second point about the input is that extra spaces, blank lines, and stray characters at the start or end can change the result. A stray character or a missing value in the middle of the input is the usual cause of a surprising result. Trimming the input first, or pasting it cleanly, avoids most of the odd results people report. The tool trims leading and trailing space where that is safe, but it cannot know which spaces inside your text are part of the data and which are accidents.

When the input is large, paste it in one go and let the tool work through it. Keep each line in the shape shown by the default example. A line ending converter handles a few thousand lines without trouble, and the result updates as you type or when you press the button, depending on the tool. If the page feels slow, the input is probably far larger than the tool was built for, and splitting it into two or three parts will fix it.

A worked example with real numbers

Here is a worked example using the default values on the page. The default text is three lines: First line, Second line and Third line, with LF endings, converted to CRLF. The page takes that input and produces the result shown in the summary rows. The page reports lines: 3, line endings found: 2, and output ending: CRLF.

You can check this example by hand, and you should, at least once. Check it by hand: three lines have two line endings between them, plus one at the end if the text ends with a newline. The default text has 2 endings between the lines. The output text looks identical, but each line now ends with a carriage return and a line feed instead of a line feed alone. The point of a worked example is not to show off the tool, but to give you one case where you already know the answer before you run it. If the tool agrees with your hand calculation on that case, you can trust it on the cases where you do not know the answer in advance. For the raw input before conversion, the word counter is the usual starting point.

Try a second example of your own next. Change one value, run it again, and see how the output moves. Try converting the same text to LF and watch the endings found stay the same while the output ending changes A line ending converter is most useful when you can predict the direction of the change, even if you cannot work out the exact number in your head. That habit, one known example and then one small change, is how people learn to trust any calculator or converter.

Who uses a Line Ending Converter, and why it matters

The first group who uses a line ending converter is developers who move files between Windows and Unix and see files show as one long line. They use it because the job comes up often, the answer has to be right, and opening a full program for it would slow them down. A quick check in the browser, right where the work is happening, is faster than switching tools. They often pair it with a text reverser when the job has two parts.

The second group is teams who fix a file that a version-control tool flags as changed on every line. For them the tool is a safety net: a way to catch a mistake before it reaches a customer, a reader, or a live site. It fixes the invisible endings that make a file look changed when only the line endings moved.

The third use is learning. A line ending converter shows the rule in action, with real input and real output, which is often clearer than reading a description of the rule. Students, new hires, and anyone picking up a new format learn faster by running a few examples through a tool and watching the output change than by reading a specification from start to finish.

Line Ending Converter vs text reverser

A Line Ending Converter and a text reverser look similar, and people often ask which one to use. The short answer is that they do different jobs: this converter changes line endings, while the text reverser only reverses the order of characters in the text. One fixes invisible endings, the other reorders what you can see, and the two have nothing in common except that both work on plain text. The two tools sit side by side in the same family, and many people use both in the same session, one after the other.

The practical rule is to start with the tool that matches the question you are asking. If the question is the one this page answers, stay here. If the question is the one the other tool answers, go there instead: a text reverser is one click away, and switching costs nothing. Using the wrong tool and getting a confident-looking wrong answer is the mistake to avoid, not switching tools.

Both tools run in the browser and both are free, so there is no cost to trying each one on the same input and comparing the outputs. When the outputs agree, you have a cross-check. When they disagree, read the method each one uses, because the difference is usually in the rule, not in a bug. That comparison is the most reliable check a free tool can offer.

Common mistakes with a Line Ending Converter

The first mistake is converting a file and then saving it in an editor that converts it back. It is easy to make because the tool accepts the input without complaint and returns a result that looks plausible. Slow down on the input, check it against the default example, and the mistake goes away.

The second mistake is expecting the visible text to change. People assume the tool will catch it, but a tool can only follow its rule; it cannot know what you meant to type. A quick look at the output, and a second look at the input when the output surprises you, catches nearly all of these.

The third mistake is mixing endings in one file and wondering why a diff shows every line changed. The fix is the same in every case: run one example you can check by hand first, then trust the tool on the rest. And the fourth is using CR for a modern file, when no modern system needs it, which is really the same lesson in a different shape: the tool is only as good as the input it is given, so the input deserves the same care as the result.

How to use this Line Ending Converter

To use this line ending converter, paste or type your input into the box at the top of the page. Type or paste your input, and the result updates as you type. The result appears in the output box below, with the summary rows above it. Copy the output with the copy control, or use the share and print buttons at the top of the page.

If the result looks wrong, check the input first, then the mode or option you picked. Most wrong results trace back to the input or the option picked, and both are visible on the page. Most wrong results trace back to one of those two places, and both are visible on the page. Change one thing at a time, so you can see which change fixed it.

Your input stays on your device. This line ending converter sends nothing to a server, stores nothing, and needs no account. You can use it as often as you like, and you can come back to it whenever the same job comes up again. For a related job, try the character counter next.

Frequently Asked Questions

CRLF is two characters, carriage return plus line feed, and is the Windows standard. LF is one character, line feed, and is the Unix and modern Mac standard. CR is one character, carriage return alone, and was the old Mac standard before Mac OS X; almost nothing uses it now.

Because the file uses LF endings and the program reading it only recognises CRLF. Old Windows Notepad did this famously: a Unix file opened as a single line. Converting to CRLF fixes it. Modern editors handle both, so the problem is rarer than it was.

Because the line endings changed across the whole file, often when a file was saved on a different operating system. The text is the same, but every line ending is different, so git sees every line as changed. Normalising the endings to one style fixes the diff.

No. Only the invisible characters at the end of each line change. The words, the spaces and the order of the lines stay exactly the same. Copy the output and paste it back into your file to apply the change.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.