Skip to content
MyToolkit.pro

Text analysis

Duplicate line remover

Paste a list and remove repeated lines while keeping the first occurrence of each. Your text stays in this browser.

Private by design: no text is uploaded or stored.

Private by design: no text is uploaded or stored.

Deduplication options

Try an example

Result

Updates when you click Remove duplicates.

Total Lines
0
Unique Lines
0
Duplicates Removed
0

What repeated

How matching works

Lines are compared in the order they appear; the first occurrence of each value is kept and later repeats are removed. By default matching is exact (case and spacing matter). Enable the options above to ignore letter case and/or surrounding spaces — the line kept in the result always keeps its original, untouched text.

How to remove duplicate lines from a list

  1. Paste your list into List to deduplicate with one item per line. Windows line endings are converted to plain newlines before any lines are compared.
  2. Choose how strict the matching should be. With no options ticked, Apple and apple count as two different lines. Tick Ignore letter case (Apple = apple) if capitalisation doesn't matter.
  3. Tick Ignore surrounding spaces ("Apple " = "Apple") if some lines may have leading or trailing spaces you can't see.
  4. Click Remove duplicates. The counters show Total Lines, Unique Lines and Duplicates Removed. Below them, the What repeated table lists each value that appeared more than once, how many times it appeared and on which line numbers.
  5. Click Copy result to copy the cleaned list.
  6. Or click Download result to save it as a .txt file.

To deduplicate a file without opening it, click Load from file or drag a .txt or .csv file onto the input field. The duplicates are removed as soon as the file loads.

The Copy removed lines button copies only the extra copies that were taken out. If you tick or untick an option after a run, the result updates straight away.

Examples: what stays, what goes and what repeated

A plain list with exact repeats (the Simple list example):

Input:            Output:
apple             apple
banana            banana
apple             orange
orange
banana

The counters show Total Lines 5, Unique Lines 3 and Duplicates Removed 2. What repeated lists apple twice, on lines 1 and 3, and banana twice, on lines 2 and 5.

The Mixed case & spacing example contains Apple, apple, APPLE (with a trailing space) and Banana. The result depends on which options are ticked:

Options ticked Result Removed
None all 4 lines unchanged 0
Ignore letter case Apple, APPLE , Banana 1
Ignore letter case + surrounding spaces Apple, Banana 2

With only letter case ignored, APPLE survives because of its trailing space.

In a list of error messages without timestamps, repeated messages collapse to one line each:

Error: timeout
Error: disk full
Error: timeout
Error: timeout

This becomes Error: timeout and Error: disk full. What repeated shows Error: timeout 3 times, on lines 1, 3 and 4.

Where a deduplicated list is useful

  • Mailing and invite lists: you merged sign-ups from two forms and want each address only once. Tick both options. [email protected] (capital A, trailing space) and [email protected] reach the same inbox, but they only count as duplicates when both case and surrounding spaces are ignored. The line that stays is the first one exactly as typed, trailing space included, so run Whitespace Normalizer afterwards if the space matters.
  • A standalone column of tags, IDs or SKUs: paste the column, remove the repeats, and paste the result into an empty column or a new sheet. Don't paste it back next to other columns. The cleaned column is shorter, so every row below the first removed duplicate would no longer line up with its neighbours.
  • Error and message lists: this works when each line contains only the message, for example a pasted list of errors or the message column from an export. Raw log lines usually start with a timestamp or process ID, which makes every line unique, so nothing is removed.
  • Checking data quality without deleting anything: copy the removed lines, or download the groups as CSV, to report which entries were duplicated and on which lines.

If you also want the cleaned list in alphabetical order, paste the result into Sort lines.

Blank lines, hidden characters and other edge cases

  • Blank lines are compared like any other value. The first empty line is kept and later empty lines are removed. If you want no blank lines at all, run the result through the Remove empty lines tool.
  • Hidden characters: the spaces option also strips a non-breaking space or a byte order mark at the start or end of a line. It does not strip a zero-width space. A line that starts with one looks identical to apple but stays as a separate line. To clean those characters out first, use Invisible character remover.
  • Whole lines only: a line is removed only if it matches an earlier line in full. To work on items inside a comma-separated row, put each item on its own line first.
  • Size: you can paste or type up to 1,000,000 characters. With Load from file you can open a text file of up to 2 MB. Very large inputs depend on your device's memory.
  • The What repeated table shows the first 20 repeated values on the page. The CSV download always contains every group.

Frequently asked questions

Does it remove lines that differ only by a tab or an extra space inside the line?

No. The spaces option only ignores whitespace at the start and end of a line, so `a b` and `a b` (two spaces) stay different, and so do a tab and a space. If you need those lines to match, normalise the spacing first with the Whitespace Normalizer.

Will it remove duplicate rows from a CSV file?

Yes, if the rows are identical as text. Each row is one line, so `1,Ann` appearing twice is reduced to one row and the header line is kept like any other line. Rows that differ in a single cell, or only in the quoting, are kept.

Why does Total Lines show one more than the number of items I pasted?

A line break after the last item creates an empty final line, and that line is counted too. Delete the final line break if you want the count to match your items exactly.

Can I keep the last occurrence instead of the first?

No. The tool always keeps the first occurrence of each value and removes the later copies. If the most recent entry matters, put the newest items at the top of the list before you paste it.

All in Text & Lists

Remove empty lines

Remove empty and blank lines from any text, or collapse runs of blank lines into one. Trim whitespace and keep everything in your browser.

Text & Lists In your browser

Distinct values finder

Find unique values, count repetitions and see where each value first occurred. Everything runs locally.

Text & Lists In your browser

Lines, words & characters counter

Count lines, words, Unicode characters, UTF-8 bytes, paragraphs and reading time locally in your browser.

Text & Lists In your browser

Random Picker

Pick one or more random items from a list, with or without replacement. Private, fair selection entirely in your browser.

Text & Lists In your browser

Sort lines

Sort lines alphabetically, numerically, in natural order or by length. Reverse, ignore case and remove duplicates. Works entirely in your browser.

Text & Lists In your browser

List randomizer

Shuffle the order of any list randomly with an unbiased Fisher-Yates shuffle. Works entirely in your browser.

Text & Lists In your browser

What do you need?

Swipe up for the next one