Remove duplicate lines

Repeated lines removed, the first of each kept — and you decide what counts as a repeat. Nothing you type here leaves your browser. It is worked out on your own device, so there is nothing to send and nothing to log — which matters more for text than for most things, because people paste in work they are not supposed to paste anywhere.

“Duplicate” is a question, not a fact

Before anything can be removed, something has to decide what counts as the same line. There are at least two live questions and every answer is defensible:

Apple / applethe same line, or two?
"x" / "x "is a trailing space a difference?

A tool that does not ask has decided for you, and it is even money which way. Both are asked above, and the default is the strict one: lines are only duplicates if they are identical. That is the answer that never surprises anybody.

The first one is the one that stays

Where a line appears several times, the first is kept and the rest go, so the order of what is left is the order you had. The count of how often each line repeated is shown, because that is often the thing somebody actually wanted — a list of duplicates is a different job from a list with the duplicates gone.

Blank lines count as lines

Two empty lines are duplicates of each other and all but the first will go. If that is not what you want, that is a different operation and this is the wrong page for it.

Where to go next