Line Sorter & Deduplicator

Sort, deduplicate and clean up lists of text instantly. Your data never leaves your browser.

Updated:

100% client-side

Input

0 lines

Output


        
—

What is Line Sorter & Deduplicator?

This tool cleans up any list of text pasted one item per line — email lists, log entries, IDs, URLs — by sorting them, removing duplicate or empty lines, and trimming stray whitespace. It's a faster alternative to writing a one-off script or spreadsheet formula every time you need to tidy up a plain-text list.

How to use Line Sorter & Deduplicator

  1. Paste your list into the Input panel, one item per line (or click Paste / Example).
  2. Choose a Sort order and a Remove duplicates mode from the dropdowns above.
  3. Toggle Remove empty lines, Trim whitespace, or Reverse final order as needed.
  4. Read the cleaned list in the Output panel, and click Copy or Download to grab it.

How line sorting & deduplication works

Paste any list of lines — IDs, URLs, emails, log entries — and this tool applies your chosen options in a fixed order: trim whitespace, remove empty lines, remove duplicates, sort, then (optionally) reverse. For example, starting from this messy input:

// Before
banana
apple
Cherry
banana
Mango
Ada
ada

grape

// After (Sort: A → Z, Dedupe: case-insensitive, Remove empty: on, Trim: on)
Ada
apple
banana
Cherry
grape
Mango

Notice "banana" (an exact duplicate) and "ada" (a case-variant duplicate of "Ada") are each removed down to one occurrence, the blank line is gone, and "Mango"'s trailing spaces are trimmed before deduplication and sorting run — otherwise "Mango " and "Mango" would have been treated as different lines. Everything runs with native JavaScript in your browser; no data is uploaded anywhere.

Examples

1. Clean up a mailing list. Sort A → Z, Remove duplicates Case-insensitive, Remove empty lines and Trim whitespace on. John@Example.com and john@example.com count as one address and the first spelling is kept. If the list needs edits inside each line (stripping a mailto: prefix, for instance), run it through the Bulk String Replacer first:

// Input
maria@example.com
John@Example.com
  ana@example.com

john@example.com
maria@example.com

// Output: 3 lines · 2 duplicates removed · 1 empty lines removed
ana@example.com
John@Example.com
maria@example.com

2. Numbers: A → Z vs Numeric. Alphabetical sorting compares character by character, so 100 lands before 2; Numeric compares values. The same two orders come out of sort and sort -n on the command line. To see which items differ between two sorted lists, compare them in the Text Compare – Side-by-Side Diff:

// Input        // A → Z        // Numeric
10              10              2
9               100             9
100             2               10
2               25              25
25              9               100

The A → Z and Z → A orders use the browser's String.prototype.localeCompare() (MDN), which is why ana, John and maria sort together regardless of case.

Frequently asked questions

Is it safe to paste sensitive data into this tool?

Yes. All processing happens in your browser using native JavaScript; no data is ever sent to a server.

How does "Numeric" sort handle lines that aren't numbers?

Lines that start with a number are compared by that numeric value, so "2" correctly sorts before "10". Lines that don't start with a number can't be compared numerically, so they're placed after all numeric lines and sorted alphabetically among themselves.

What's the difference between case-sensitive and case-insensitive duplicate removal?

Case-sensitive treats "Foo" and "foo" as different lines. Case-insensitive treats them as duplicates and keeps only the first one it sees. It's an explicit three-way choice (off / case-sensitive / case-insensitive) so you always know which behavior you're getting.

Does it handle very large lists?

Yes. Deduplication uses a Set for O(n) lookups instead of comparing every line against every other line, so lists with several thousand lines still process instantly.