Sort Lines & Remove Duplicates

Paste a list and sort it, de-duplicate it or clean it up with one click.

What it can do

Sort A to Z or Z to A, sort by length, reverse or shuffle, deduplicate, remove blank lines, trim whitespace and add line numbers. The tool also shows how many lines went in and came out.

Deduplicating

Deduplicate removes repeated lines and tells you how many were removed. It compares lines ignoring case, so Apple and apple count as the same line: the surviving line keeps the position of the first copy but the spelling of the last copy.

How to use it

  1. Paste your lines into Input lines.
  2. Press an action such as A → Z or Deduplicate.
  3. Copy the Output.

Example

These six lines:

banana
apple
cherry
apple
date
banana

become four lines after Deduplicate: banana, apple, cherry, date (2 removed).

Common use cases

What each button really does

Every button works on the text in Input lines, not on the current Output. If you press Deduplicate and then A → Z, the second click starts again from your original input and the deduplication is lost. To combine steps, copy the Output, paste it back into the input box, and then press the next button.

A → Z and Z → A use the browser's locale-aware string comparison, so the order follows dictionary rules rather than raw character codes: accented letters sit next to their plain forms, and apple and Apple end up side by side instead of capitals all coming first. Length ↑ and Length ↓ compare character counts, and lines of equal length keep their original relative order.

Numbers are sorted as text

The sort is alphabetical, not numeric. These lines:

item10
item2
item1

come out of A → Z as item1, item10, item2, because the character 1 sorts before 2. If you need real numeric order, pad the numbers with leading zeros first (item01, item02, item10) or use a spreadsheet or sort -n.

Deduplicate is case-insensitive

Deduplicate treats Apple and apple as the same line. The surviving line keeps the position of the first copy but the spelling of the last copy. Given banana, Apple, apple, Banana, you get two lines: Banana then apple. Blank lines are deduplicated too, so only one empty line survives. If exact, case-sensitive matching matters (for example case-sensitive IDs), check the result before relying on it.

Blank lines, trailing newlines and numbering

A final newline in your input counts as an empty last line. After an ascending sort that empty line floats to the top of the output, which looks like a stray blank row. Press Remove Blanks first (and copy the result back into the input) to avoid it. Trim Whitespace strips leading and trailing spaces from each line, which is worth doing before deduplicating because cat and cat are otherwise different lines.

Add Line Numbers prefixes each line with its position and a full stop, such as 1. banana. The statistics bar shows how many lines went in, how many came out and how many were removed; while you type it shows the line count and the number of unique lines.

Limits

There is no case-sensitive switch, no numeric or natural sort, and no option to sort by a column or field. Everything runs in the browser on pasted text, so very large lists are limited by your device's memory rather than by an upload cap.

Frequently asked questions

How do I remove duplicate lines?

Press Deduplicate. One line is kept for each distinct value, compared ignoring case; the first position is kept but the last spelling wins.

Is the sort case-sensitive?

No, not strictly. A to Z uses locale-aware comparison, so apple and Apple end up next to each other rather than all capitals first. There is no case-sensitive switch, and numbers are sorted as text (item10 comes before item2).

Can I number the lines?

Yes, use Add Line Numbers.

Is my data uploaded?

No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.

Why did Deduplicate change the capitalisation of one of my lines?

Deduplicate compares lines ignoring case. When two lines differ only by case, the one that appears later supplies the text, while the position of the first one is kept. Normalise case first with the Case Converter if you need a particular spelling.

Why is there an empty line at the top of my sorted list?

Your input probably ended with a newline, which counts as an empty final line, and empty strings sort before everything else. Use Remove Blanks, copy the result into the input box and sort again.

Can I run several actions in a row?

Each button reads the Input box, not the Output, so copy the Output back into the Input between steps.

Related tools

Explore all developer tools →