Skip to contentSkip to the inputSkip to the result

Remove duplicate lines

Keep a single copy of repeated list entries.

Loading tool

Instructions

Remove duplicate lines

How to use

  1. Put one entry per line and remove duplicates.
  2. The first occurrence stays in place.

Supported input

  • Exact comparison by default.
  • You can ignore case and surrounding spaces, drop blank lines, list only repeated lines or sort the result.

Input example

apple / pear / apple

Result example

apple / pear

Troubleshooting

  • Check required inputs, numeric ranges and the selected conversion direction.

How it works

  • Keep a single copy of repeated list entries.

Removing duplicate lines: what counts as the same line

Typical jobs

  • Merging two sign-up lists so nobody receives the same email twice.
  • Reducing free-text survey answers to the distinct keywords people used.
  • Seeing which error message fills a log, and how often: Only repeated lines adds a ×count to each.
  • Checking a column of order numbers or product codes copied from a spreadsheet for repeats.

Exact matching and loose matching

Exact matching treats two lines as the same only when every character is identical. One capital letter, one trailing space or one invisible character makes them different.

Loose matching prepares each line before comparing: it trims spaces at both ends, lowers the case, and converts the text to Unicode Normalization Form C. That prepared value is only used for the comparison; the line you get back is the first one as it was written.

Take four lines: Café typed with the single character é, Café typed as e plus a combining accent, “café ” with a trailing space, and CAFÉ. Exact matching keeps all four, because no two are the same characters; loose matching keeps one line, the first Café.

Identical on screen, different underneath

Many letters have two valid encodings. é can be stored as the single character U+00E9 or as e followed by U+0301, and a Korean syllable such as 한 can be one character or three letters. Unicode UAX #15 calls these canonically equivalent, but the stored characters differ, so a plain comparison misses them.

File names created on a Mac, and lists copied from them, often arrive in the decomposed form. If the same name survives twice, switch to loose matching, which normalises both before comparing.

Worked example: merging mailing lists

  1. 1Input, one per line: [email protected], [email protected], [email protected], [email protected], [email protected].
  2. 2Exact matching removes only the second [email protected] and leaves four lines; [email protected] differs by its capitals.
  3. 3Loose matching leaves three: kim, lee and park.
  4. 4Only repeated lines lists [email protected] ×2 and [email protected] ×2.
  5. 5RFC 5321 allows the part before the @ to be case-sensitive, but in practice almost every mail provider ignores case there, so loose matching is the right choice for a mailing list.

What it will not merge

  • Full-width and ordinary Latin letters (ABC and abc): Form C leaves them distinct.
  • Spacing inside a line: “Mary Ann” and “MaryAnn” stay apart. Remove the spaces with find and replace first if they should match.
  • Rows that repeat in one column only: the whole line is compared, so “Smith, 82” and “Smith, 90” both stay. Use your spreadsheet’s remove-duplicates command to match on one column.
  • Near-duplicates and typos. Alphabetical order also brings a kept blank line to the top; choose to drop blank lines if you do not want it.

Checked

Frequently asked questions

Can it remove lines that differ only in case or spaces?

Yes. Switch the match setting to Ignore case and outer spaces, and Apple and 'apple ' count as the same line. The first spelling is the one kept. By default only exact matches are removed.

Can I see which lines repeat and how often?

Choose Only repeated lines and the result lists each line that appears more than once, with its count, such as ×3.

Does removing duplicates change the order?

No. By default lines stay in the order they first appeared. Choose Alphabetical to sort what remains, with numbers in natural order. Blank lines count as a line too, so several of them become one; set Blank lines to Remove all to drop them.