devtools

Line Sorter & Deduplicator

Sort lines alphabetically or numerically and remove duplicate or blank lines, right in your browser. Case-insensitive, locale-aware, and fully private.

Runs entirely in your browser — your data never leaves your device.

How to use Line Sorter & Deduplicator

What it does & when you need it

You have a pile of lines — a list of email addresses, a .gitignore, exported tags, a column pasted out of a spreadsheet — and you need them in order, with the duplicates gone. This tool sorts the lines of whatever you paste and, optionally, strips out repeats and blank rows. It handles the fiddly parts a naive sort gets wrong: numbers that should read as numbers, mixed casing, accented characters, and stray whitespace.

It runs entirely in your browser. Nothing you paste is uploaded, which matters when the list is a set of customer emails, internal hostnames, or API keys. The sort is the same locale-aware comparison your language runtime uses, so the result is stable and predictable rather than a surprise from a raw byte ordering.

Reach for it when you're cleaning a word list before a diff, de-duplicating a CSV column, alphabetising enum values before committing, or turning a messy paste into something you can scan.

How to use

  1. Paste your lines into the input buffer, or press Sample to load an example. You can also Upload a .txt, .csv, or .log file.
  2. Pick a direction with the A → Z / Z → A toggle, then enable the options you need: Remove duplicates, Remove blank lines, Ignore case, Numeric, and Trim.
  3. The sorted buffer updates as you type. Press Sort (or Ctrl/Cmd + Enter) to re-run explicitly, and Copy to grab the result. The status bar reports the line count and how many lines were removed.

Things worth knowing

Lexicographic order is not numeric order. By default the sort compares lines character by character, so "10" lands before "9" — the first character 1 is "smaller" than 9, and the comparison never gets far enough to notice that ten is the larger number. That's correct for words but wrong for anything with embedded numbers, like item2, item9, item10 or version strings. Turn on Numeric and the comparison switches to natural ordering (built on localeCompare with { numeric: true }), so runs of digits are compared by value instead of one glyph at a time.

Deduplication happens after the sort, and keeps the first occurrence. Order matters here: sorting first and then removing duplicates can give a different result from removing duplicates and then sorting, because "first occurrence" is defined relative to whatever order the lines are already in. This tool always sorts before it dedups, so the survivor of each duplicate group is the first one in sorted order — deterministic and easy to reason about. If you only want to collapse repeats without reordering, use a dedicated whitespace and line cleaner instead.

Ignore case groups variants without rewriting them. With Ignore case on, Apple and apple sort next to each other, but the output still shows each line exactly as you typed it — the option changes the comparison, not the text. Two lines that differ only in case are therefore not treated as duplicates, so both survive de-duplication. If you actually want to normalise casing across the list, run it through the case converter first.

Comparison is locale-aware, so accents sort sensibly. A raw code-point sort orders by Unicode value, which puts z (U+007A) before an accented é (U+00E9) and scatters international text to the bottom of the list. The localeCompare collation used here places é next to e, where a reader expects it, so apple, égal, zebra come out in that order rather than with égal marooned at the end.

Once your list is clean, you might count what's left or line two versions up in a diff checker to see exactly what changed.

Examples

Sort and de-duplicate a list

banana
apple
cherry
apple
banana

With Remove duplicates on, repeats collapse to a single sorted, unique list: apple, banana, cherry.

Natural-sort versioned items

item10
item2
item9

A plain sort gives item10, item2, item9; enable Numeric for the natural item2, item9, item10.

Alphabetise text with accents

zebra
égal
apple

Locale-aware sorting yields apple, égal, zebra — unlike a byte sort that would strand égal after zebra.

Frequently asked questions

How do I sort lines and remove duplicates at the same time?

Paste your lines, keep the A → Z direction (or switch to Z → A), and leave Remove duplicates enabled. The tool sorts first and then collapses repeats, so you get one alphabetised, de-duplicated list in a single pass. The status bar shows how many lines were removed.

Why does "10" sort before "9" in my list?

A default sort is lexicographic: it compares character by character, and the character "1" is smaller than "9", so "10" comes first. Enable the Numeric option to compare runs of digits by value instead, giving natural ordering like 2, 9, 10 for versioned filenames or numbered items.

Which duplicate does the tool keep?

It keeps the first occurrence, but deduplication runs after the sort, so the survivor is the first line in sorted order. Because the sort is stable, the result is fully deterministic — you get the same output every time for the same input and options.

Are "Apple" and "apple" treated as duplicates?

No. Even with Ignore case turned on, that option only affects the comparison used for ordering — it groups the two lines next to each other but preserves their original casing. Lines that differ only in case are kept as distinct entries, so both survive de-duplication.

How are accented and non-English characters sorted?

Sorting uses locale-aware comparison (localeCompare), which places an accented letter like "é" next to "e" where a reader expects it. A raw code-point sort would instead order by Unicode value and push accented letters past "z", scattering international text to the bottom.

Is my text uploaded anywhere?

No. All sorting, de-duplication, and blank-line removal run entirely in your browser with no network requests, so a list of emails, hostnames, or keys never leaves your machine.