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 the tool, then paste the sample input below. Everything runs locally in your browser.
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
apple
banana
apple
cherry
banana
Expected output
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
- Paste the list of lines.
- Trim whitespace and drop blank lines.
- Remove duplicate lines.
- Sort the result if you need order.
- 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.
Clean and compare lists, diff files and build SQL filters — grouped in one place.
Practical example and expected result
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. In practice, this is most useful when you need a quick, repeatable check on a developer artifact before adding it to a ticket, pull request, test fixture, or support note.
A realistic input for this workflow is apple banana apple cherry banana. The expected result should resemble apple banana cherry, with the same important values preserved.
Troubleshooting checklist
- Confirm you copied the complete developer artifact and not only a partial line or truncated preview.
- Run the local tool once with a safe sample, then repeat with the real data only if your team policy allows it.
- Check quoting, escaping, whitespace, encoding, timestamps, and environment-specific values before trusting the result.
- Before sharing output, remove secrets, tokens, cookies, customer data, and production hostnames that are not needed for the review.
Next useful steps
- Compare two lists for a related validation or follow-up step.
- Diff two text blocks for a related validation or follow-up step.
- Build a SQL IN clause for a related validation or follow-up step.
- Use Magic Box when you are not sure which tool should handle the next artifact.
Review checklist before sharing the result
For Clean and deduplicate a list of lines, the safest workflow is to test with a small sample, confirm the output shape, then repeat with the real artifact only when needed. Keep the original input open until you verify that no value was dropped, decoded twice, sorted unexpectedly, or changed from text into a different type.
Before copying the result into a pull request, issue, chat thread, or support ticket, scan for private values. Replace real IDs, bearer tokens, session cookies, email addresses, internal hostnames, and customer data with placeholders. If another tool is listed above, use it as the second pass rather than manually editing complex output.
- Keep one line of context explaining why the transformation was needed.
- Preserve enough sample structure for a reviewer to reproduce the result locally.
- Note any assumptions about encoding, timezone, delimiter, schema version, or runtime environment.