Free, browser-based utilities for everyday developer workflows

Clean and deduplicate a list of lines

Paste a messy list and trim whitespace, drop blank lines, remove duplicates, and sort it — turning copied IDs, emails, or log lines into a clean set.

Open this example in Line Tools

Open the tool, then paste the sample input below. Everything runs locally in your browser.

Open this example in Line Tools →

The problem

A list copied from a spreadsheet or a log is full of trailing spaces, blank lines, and duplicates. Feeding that into a query or comparison gives wrong counts. Cleaning and deduplicating it first produces a reliable set to work with.

Sample input

Messy list
  apple
banana

apple
 cherry
banana

Expected output

Cleaned (trim, dedupe, sort)
apple
banana
cherry

Leading/trailing spaces are trimmed, the blank line is dropped, the duplicate apple and banana are collapsed, and the result is sorted.

How to do it

  1. Paste the list of lines.
  2. Trim whitespace and drop blank lines.
  3. Remove duplicate lines.
  4. Sort the result if you need order.
  5. Copy the cleaned list.

Common mistakes

  • Not trimming, so " apple" and "apple" count as different.
  • Case-sensitive dedupe treating Apple and apple as distinct.
  • Leaving blank lines that become empty entries downstream.
  • Sorting numbers as text so 10 comes before 2.
  • Hidden characters such as a trailing carriage return.

Related tools

Related guides

FAQ

How do I remove duplicate lines from a list?

Paste the list and apply dedupe. Identical lines are collapsed to one; trimming whitespace first ensures lines that differ only by spaces are treated as the same.

Why trim before deduplicating?

Leading and trailing spaces make otherwise-identical lines look different, so trimming first lets the dedupe step catch them.

Is the dedupe case-sensitive?

By default lines that differ in case are distinct. Normalize case first if Apple and apple should be treated as the same entry.

Can I sort the result?

Yes. After cleaning you can sort the lines. For numbers, use a numeric sort so 2 comes before 10.

Is my list uploaded?

No. Cleaning runs locally in your browser. Your list is not sent to a server.

Line cleaning runs locally in your browser. Nothing is uploaded.

Explore more data cleanup and QA tools

Clean and compare lists, diff files and build SQL filters — grouped in one place.

View the data cleanup & QA toolkit →