Sort & Dedupe Lines

Sort, dedupe, and reverse lines of text

Input
Output

Why sort lines in the browser?

Sorting and deduplicating a list is a 5-second job at the command line (`sort -u`), but you don't always have a terminal handy — pasting from a spreadsheet column, cleaning up a list of imports, deduplicating email addresses scraped from a page. This tool does it in the browser with no upload.

Sorts use the browser's native locale-aware comparison, so `é` sorts near `e` rather than at the end of the alphabet. Numeric sort isn't smart — '10' sorts before '2' lexicographically — so prefix numbers with zeros if numeric ordering matters.

Use cases

  • Dedupe a list — sort `package.json` dependency lines so duplicates land adjacent.
  • Alphabetise imports — re-order import statements before code review (when your linter doesn't).
  • Build clean .gitignore — sort entries so additions are easier to merge without conflicts.
  • Order CSV rows — paste lines from a single column and sort for review or quick lookup.

Examples

Sort + dedupe
Input
banana
apple
cherry
apple
Output
apple
banana
cherry

Frequently asked questions

Is the sort case-sensitive?

Sorting uses your locale's order (`localeCompare`), which keeps 'Apple' and 'apple' close together. There's no separate case-sensitivity toggle.

Does it sort numbers correctly?

Lexicographic sort treats '10' as less than '2'. For true numeric sort, pad numbers with leading zeros first.

How is dedup detected?

Exact, case-sensitive line match. Whitespace is significant — ` apple` and `apple` are different lines.

Are blank lines kept?

Sorted with everything else by default. Strip them first if you want them removed.

Is the data sent anywhere?

No — sorting happens entirely in your browser.