Sort Text Lines and Remove Duplicates
Alphabetize a list, remove duplicate lines, and tidy whitespace. Runs locally, nothing uploaded.
What this tool does
This tool sorts and cleans a list of text lines entirely in your browser. Paste one
item per line and it can alphabetize the list A to Z or Z to A, remove duplicate lines,
trim whitespace from each line, and drop blank lines. Sorting uses
Intl.Collator, the browser's locale-aware comparison, so accented letters
and embedded numbers order sensibly. Runs entirely in your browser - verify: open
DevTools, then the Network tab. Zero requests.
How to use it
Paste or type your list in the top box, one item per line. Pick a sort order (A to Z,
Z to A, or keep the original order) and toggle any of the options: case-insensitive
sort, natural numeric sort, remove duplicate lines, trim whitespace, and remove blank
lines. The result updates live in the lower box with a running count of how many lines
came out. Use Copy to put the whole result on your clipboard. For
example, the list banana, apple, Banana,
apple with A to Z sort, case-insensitive, and remove duplicates on returns
just apple then banana (two lines).
Common use cases
- Alphabetizing a list of names, tags, imports, or dictionary words.
- Removing duplicate lines from a log, an export, or a pasted column.
- Cleaning a messy list by trimming stray spaces and dropping blank lines.
- Sorting file names or version labels in natural order so item 2 comes before item 10.
- Deduplicating a keyword or email list before pasting it somewhere else.
Common pitfalls
- Case affects both sorting and dedupe. With case-insensitive off, "Apple" and "apple" are treated as different lines and are not collapsed. Turn the toggle on when you want case ignored for both ordering and duplicate removal.
- Natural sort is about embedded numbers. It makes "item2" sort before "item10". If your lines contain no digits, turning it on changes nothing.
- The pipeline order is fixed. Lines are trimmed, then blanks removed, then duplicates removed, then sorted. A trailing newline in your input shows up as a blank line unless you enable remove blank lines.
Frequently asked questions
- How do I sort a list of text lines alphabetically?
- Paste your list into the box with one item per line, then choose A to Z from the sort order menu. The result updates live as you type or change options. Turn on case-insensitive sort if you want "apple" and "Apple" grouped together instead of all capitalized lines sorting first.
- How does removing duplicate lines work?
- Enable "Remove duplicate lines" and the tool keeps the first time each line appears and drops every later copy. By default the match is exact, so "Apple" and "apple" count as different lines. Turn on case-insensitive sort and duplicates are matched without regard to case, so those two collapse into one.
- What is natural or numeric sorting?
- Ordinary text sorting compares character by character, so "10" would sort before "2" because "1" comes before "2". Natural sort reads runs of digits as numbers, so "2" sorts before "10" the way a person expects. This tool uses Intl.Collator with the numeric option for locale-aware natural ordering.
- What does case-insensitive sort change?
- With case-insensitive sort off, most locales place differences in case close together but still treat them as distinct, and duplicate matching is exact. With it on, letters are compared without regard to upper or lower case, and duplicate removal folds "Banana" and "banana" into a single entry.
- In what order are the options applied?
- The pipeline is fixed and predictable: first each line is trimmed if trimming is on, then blank lines are removed if that option is on, then duplicates are removed, and finally the remaining lines are sorted. Fixing this order means the result does not depend on which toggle you clicked last.
- Does this tool upload my text anywhere?
- No. Every step runs in your browser with plain JavaScript, and nothing you paste is uploaded, logged, or stored. You can confirm this by opening DevTools and watching the Network tab while you use the tool: there are zero requests.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.