Skip to content
K Knidox Search…
Writing · Editing

Line Sorter & Deduper

Sort a list of lines alphabetically or by length, and optionally strip duplicates.

Try an example — tap to load
Sort order
Result

5 lines in → 4 lines out · 1 duplicate removed

This tool reorders a list of lines and cleans it up. Paste one item per line and choose a sort order — A→Z, Z→A, by length, or reverse. Optional toggles remove duplicate lines, ignore letter case, trim whitespace, and drop blank lines. A live count shows lines in, lines out, and duplicates removed.

What it does

Each line of your input is treated as one item. The tool applies your chosen sort order and any cleanup toggles, then shows the result ready to copy. A→Z and Z→A order the lines alphabetically, By length puts the shortest lines first, and Reverse simply flips the current order without sorting. Turn on Remove duplicates to keep only the first copy of each repeated line, Case-insensitive to treat Apple and apple as the same, Trim whitespace to strip leading and trailing spaces, and Remove blank lines to delete empty rows.

How the ordering works

Sorting uses locale-aware comparison, so accented and mixed-case words land where a reader expects rather than in raw byte order. When Case-insensitive is on, comparison and duplicate matching both ignore letter case. Cleanup runs before sorting: lines are trimmed, blanks are dropped, duplicates are removed keeping the first occurrence, and only then are the survivors put in order.

  1. 1
    Paste one item per line. For example the five lines: banana, apple, cherry, apple, date — that is 5 lines in.
  2. 2
    Pick a sort order. Choose A→Z, Z→A, By length, or Reverse. A→Z uses locale-aware alphabetical order.
  3. 3
    Turn on Remove duplicates. The second “apple” is dropped and the first is kept, so 1 duplicate is removed.
  4. 4
    Set the matching options. Case-insensitive treats “Apple” and “apple” as equal; Trim whitespace and Remove blank lines tidy stray spaces and empty rows.
  5. 5
    Read the result and copy. A→Z gives apple, banana, cherry, date — 5 lines in → 4 lines out · 1 duplicate removed. Use Copy lines to grab it.

Sort orders and options

What each control does to your list.

ControlEffect
A → ZSorts lines alphabetically, ascending, using locale-aware comparison.
Z → ASorts lines alphabetically in reverse (descending).
By lengthOrders by character count, shortest first; ties broken alphabetically.
ReverseFlips the current line order without sorting.
Remove duplicatesKeeps the first occurrence of each repeated line and drops the rest.
Case-insensitiveIgnores letter case when sorting and when matching duplicates.
Trim whitespaceStrips leading and trailing spaces and tabs from every line.
Remove blank linesDeletes empty lines from the output.

Where it helps

Cleaning lists. Turn a messy bullet dump, reading list, or set of names into a tidy, ordered, duplicate-free list. CSV columns. Paste one column of exported data, sort it, and strip repeats before pasting it back. Keyword lists. SEO and research keyword sets often arrive with duplicates and inconsistent case — case-insensitive dedupe collapses them, and A→Z makes scanning easy. Because the tool works line by line, anything you can put one-per-line — tags, emails, imports, to-do items — sorts and dedupes the same way.

Does it keep the first or the last duplicate?
It keeps the first occurrence of each line in your input order and removes every later copy. So if “apple” appears on lines 2 and 4, line 2 is kept and line 4 is dropped.
Is sorting case-sensitive?
By default yes — capitals and lowercase are compared as written using locale-aware order. Turn on “Case-insensitive” and both the sort and the duplicate check ignore letter case, so “Apple” and “apple” are treated as the same.
How does “By length” break ties?
Lines are ordered by character count, shortest first. When two lines are the same length they fall back to alphabetical order, so the result is stable and predictable.
What does “Reverse” actually reverse?
It flips the current order of the lines without sorting them. After any cleanup like trimming or deduping, the surviving lines are simply listed bottom-to-top.
In what order do the cleanup steps run?
Whitespace is trimmed first, then blank lines are removed, then duplicates are dropped keeping the first copy, and finally the remaining lines are sorted. That is why the counts read as lines in → lines out.
Does trimming affect what counts as a duplicate?
Yes. With “Trim whitespace” on, “ apple” and “apple ” become identical after trimming, so they are matched as duplicates. Leave trimming off to treat differently-spaced lines as distinct.