Line tools: deduplicate, sort and number
Paste a list and strip the duplicates and blank lines, sort it, and number it. Pick only the stages you need, and see how many lines survived and how many were dropped. It runs in the page, so a list of addresses or customer names never leaves your machine.
Input
The stages run top to bottom: trim → drop blank lines → remove duplicates → sort → add numbers. The same settings always produce the same list.
The default is dictionary order, which puts "item2" before "item10". Ticking this sorts by character code instead, which groups symbols and capitals first.
Output
Related tools
All tools- Word & character countCharacters, words, lines and reading time, counted as you type.
- Full-width / half-width converterConvert Japanese text between full-width and half-width, one character class at a time.
- JSON formatter & validatorPretty-print, minify, sort keys — and point at the exact line that broke.
- CSV ⇄ JSON converterCSV and JSON, both ways — quoted commas and line breaks included.
Highlights
- The stages combine
- Trimming, dropping blanks, deduplicating, sorting and numbering are separate switches, and the order they run in is fixed and printed on the page. There is no ambiguity about whether duplicates were removed before or after the sort, so the same settings always give the same list. Letting the stages be reordered would mean the same row of tick boxes could produce different answers, which makes a result impossible to explain after the fact.
- You can see what was dropped
- Alongside the output count, the removed lines are broken down into blanks and duplicates. When 800 rows come back as 612, you can tell at a glance how the missing 188 divide, which is the difference between a result you can hand on and one you have to re-check. If more went missing than you expected, it is either the trim doing more than you thought or genuinely more duplicates than you thought — and the split tells you which.
- Reproducible by design
- There is no shuffle. Every ordering option is deterministic, so the same input and the same settings give the same output every time — running the job again never quietly produces a different file. Note down which switches you used and somebody else can reproduce the same list from the same input.
How to use it
Paste your lines
Paste into the list box. A column copied out of a spreadsheet arrives one entry per line. The sample button fills in a short list with duplicates and blanks if you want to see it working first.
Pick the stages
Use the clean-up switches for trimming, blank lines and duplicates, and the sort control for A→Z, Z→A or reverse. Tick line numbers if you want them, and choose the format. The result is rebuilt each time you change something.
Check the counts and take the list
Under the result you get lines in, lines out, lines removed and how many of those were duplicates. Confirm the list shrank by the amount you expected, then copy it out.
What each stage does
- What order do the stages run in?
- Trim, then drop blank lines, then remove duplicates, then sort, then number. Trimming first means "Tokyo" and "Tokyo " are treated as the same line. Numbering last means the numbers always run 1..n with no gaps. Leave the trim off and two lines that look identical on screen both survive, because one of them ends in a space. The order itself is fixed, but each stage switches off on its own, so "drop the blanks and change nothing else" is a valid setting.
- Which duplicate survives?
- The first occurrence; later copies are dropped. Matching happens before the sort, so what survives is whichever came first in the list you pasted. With "ignore case" ticked, Tokyo and tokyo count as the same line — but the line kept is the one as you wrote it. Nothing is lower-cased in the output — the form used for matching and the form kept in the result are deliberately separate. Matching is otherwise an exact, whole-line comparison, so full-width and half-width versions of the same name count as two different lines. To collapse those as well, normalise the width first and dedupe afterwards.
- What does A→Z actually compare?
- Dictionary order by default, with runs of digits compared as numbers — so "item2" sorts before "item10", which is what a person writing a list means. "Sort by code point" switches to raw Unicode order instead, grouping symbols, digits, capitals and lower case in that sequence; that is the one to use when the result has to line up with a program's output. The sort is stable either way, so lines that compare equal keep their original relative order. Note that "reverse" is not a sort at all — it flips the existing order — so the code-point option has no effect on it.
- What counts as a blank line?
- A line with nothing on it, and also a line containing only spaces or tabs — the two are indistinguishable on screen, and pasted spreadsheet columns are full of the second kind. Line endings are unified before anything else runs, so a file written on Windows does not fail to deduplicate because of an invisible carriage return. A trailing newline at the end of the text is not counted as a line either, so the result never gains a phantom blank at the bottom.
Questions
- Is there a size limit?
- None by design. Tens of thousands of lines are fine, though typing may feel less immediate on a modest device.
- Is my list stored?
- No. Everything happens in the page and nothing is sent to a server. Close the tab and it is gone.
- Why does Japanese not sort into kana order?
- Because the reading of a kanji is not recoverable from the characters — 東 may be read higashi or azuma depending on the word, and no tool can decide that from the string alone. A spreadsheet can do it only because it remembers the reading you typed, and that memory is gone the moment the text is copied out as plain characters. To get kana order, keep a separate reading column and sort that. Lines written purely in kana do sort roughly into kana order.
- Do the line numbers end up in the copied text?
- Yes. Copying takes the numbers with it, so untick the option if you want a plain list. If you send a numbered result back to the input, the numbers become part of the line text on the next pass and will be matched and sorted along with everything else, so stacking passes on a numbered list is rarely what you want. The format can be a full stop, a colon or a tab; the tab form splits into two columns when pasted back into a spreadsheet.
- Can I use it on a spreadsheet column?
- Copy the column, paste it in, and it comes back in the same shape ready to paste back. If you paste several columns at once the separators arrive as tabs and the whole row is compared as one line — to deduplicate on a single column, paste only that column. A cell containing its own line break arrives as several rows and shifts everything under it, so fix those cells before copying.