Sort Lines & Remove Duplicates
Sort, deduplicate and clean up text lists in a single step.
Fixed order of operations: trim → remove empty → duplicates → sort → number/prefix/suffix → join lines.
Clean up
Duplicates
Sort
Add
Before
After
How do you sort lines alphabetically and remove duplicate lines online?
Docuboxer's line sorter and deduplicator runs your list through a fixed, predictable pipeline: trim whitespace, drop empty lines, remove duplicates, sort, and add numbering or a prefix/suffix to every line, updating live as you type. You can deduplicate while ignoring case or whitespace differences, flip it around to keep only the lines that were duplicated, sort numerically even when the number is surrounded by text ("Item 12", "row #7"), or shuffle a list with a proper Fisher-Yates random order. It also handles alphabetical sorting the way a locale-aware dictionary would, correctly placing accented characters and non-English letters like the Spanish ñ in their real alphabetical position instead of dumping them at the end of the list — a detail most line-sorting tools, built with plain code-point sorting, get wrong. Everything runs locally in your browser, it's free, with no signup and no line limit, and your text never leaves your device.
How to use Sort Lines & Remove Duplicates
- Paste or type your list of lines into the input box on the left.
- Check the "Clean up" boxes you need: trim whitespace, remove empty lines, or collapse multiple internal spaces.
- Pick a "Duplicates" mode (remove or keep only duplicates) and a "Sort" mode — A-Z, Z-A, numeric, by length, random or reverse; the result updates instantly on the right.
- Optionally add automatic numbering or a prefix/suffix to every line in the "Add" section.
- Copy the result with one click, or download it as a .txt file.
Common use cases
Cleaning up email lists or tags exported from a spreadsheet
Strip duplicates and empty lines from a list of emails, categories or tags before importing it into a CRM or database, without opening Excel.
Sorting a list that includes non-English text correctly
Alphabetize a bilingual glossary or product catalog and have accented letters and characters like ñ land in their correct dictionary position instead of getting pushed to the end by plain Unicode code-point sorting.
Finding which values are repeated in a list
Use "keep only duplicates" to spot at a glance which product codes, IDs or references show up more than once in a large export.
Turning a plain list into a numbered checklist
Convert loose lines into a numbered list ("1. ", "1) ") ready to paste into a document, a ticket, or a step-by-step guide.
Joining a column of values into one comma-separated line
Merge a vertical list into a single line with the separator of your choice, handy for pasting values into a formula, an array, or a SQL IN (...) clause.
Frequently asked questions
How do I remove duplicate lines from a list?
Paste your list into the input box and select "Remove duplicates" under Duplicates. The first occurrence of each line is kept and later repeats are dropped, without reordering anything else.
Does it sort lines alphabetically the same way as a plain JavaScript sort?
No — it uses Intl.Collator instead of a raw code-point sort, so accented letters and non-English characters land in their correct alphabetical position rather than being pushed after "z", which is what a default sort would do.
Can I sort a list of numbers even if they have text around them?
Yes. Numeric sort extracts the first number from each line even when it's surrounded by text ("Item 12", "row #7"), and lines without any number are always pushed to the end, in either sort direction.
What's the difference between "remove duplicates" and "keep only duplicates"?
"Remove duplicates" keeps every line, unique or not, and only drops the extra repeats. "Keep only duplicates" does the opposite: it discards lines that appear just once and shows only the ones that were repeated.
In what order are the operations applied if I check several at once?
Always the same fixed order, shown at the top of the tool: trim, remove empty, duplicates, sort, number/prefix/suffix, and finally join lines if that's enabled. That keeps the result predictable no matter what order you check the boxes in.
Is my text uploaded to a server?
No. All processing happens locally in your browser with JavaScript. Your list never leaves your device, the tool is free, with no signup and no practical line limit.