Remove duplicate lines
Remove duplicate lines or extract one copy of each repeated line.
How it works
Keep the first or last occurrence of each line, or show only groups that occur more than once. Choose whether to ignore case, ignore spaces and tabs at line edges, or discard blank lines. Selected lines retain their original text and relative position. Line endings are normalized to LF.
Keep first, keep last or extract repeated lines
For a list of Apple, Pear, Apple and Plum on separate lines, Keep first returns Apple, Pear, Plum. Keep last returns Pear, Apple, Plum. Repeated lines only returns Apple once. With Ignore case selected, Apple and apple are one group, but the chosen line retains its original spelling.
Matching and blank lines
Matches compare whole lines literally. Ignore case uses default Unicode lowercase conversion, not full case folding or accent normalization. Spaces and tabs remain significant by default. Enable Ignore spaces and tabs at line edges to compare after ignoring only leading and trailing ASCII spaces (U+0020) and tabs (U+0009). For example, Apple and Apple followed by two spaces form one group; the selected line keeps its original spaces. Internal spaces and other Unicode whitespace remain significant. This option can be combined with Ignore case. Remove blank lines excludes whitespace-only lines using JavaScript trim rules before grouping. CRLF and CR become LF; a final newline contributes an empty line, which participates like any other line unless blank lines are removed. Output joins selected lines with LF; no final newline is forced. No matches or a sole empty selected line yield empty output. Up to 50,000 UTF-16 units; processing stays in your browser.
Count repeated line groups
Enable Show duplicate line statistics to see total input line elements, eligible lines after blank-line removal, distinct eligible groups, groups with two or more occurrences, duplicate occurrences beyond one per group, and selected output lines. For Apple, Orange, Apple, Banana, Orange, Apple on separate lines, the counts are 6, 6, 3, 2, 3 and 3 in All distinct lines mode. Repeated lines only displays 2 selected lines but leaves the other counts unchanged. Empty input is one empty line element under these matching rules; a sole selected empty line still produces an empty copy result.
Copy duplicate line statistics
With statistics enabled, use Copy duplicate line statistics to copy the six counts as tab-separated Metric and Value columns, without copying any input or result lines. For Apple, Orange, Apple, Banana, Orange on separate lines, the counts are 5, 5, 3, 2, 2 and 3 in All distinct lines mode. Repeated lines only changes the displayed count to 2. The statistics can still be copied when the result is empty.
Related text tools
Use Alphabetical line sorter for ascending, descending or natural numeric order, or Text line filter to keep or remove lines containing a phrase, or Whitespace cleaner to adjust spaces and tabs before comparing lines.