Sort and Dedupe Lines

Sort lines alphabetically, numerically, naturally or by length — and remove duplicates, keeping either the first or the last.

Runs 100% in your browserNothing is uploaded to a serverInstant results

Options

Input

Result

Copied!

About sorting and deduplicating lines

Paste a list and this tool will sort it and remove duplicate lines in one pass. Alphabetical order is the usual default; natural order is the one you actually want for filenames, because it puts file2 before file10 instead of after it. Numeric order reads the number at the start of each line and sends lines without one to the bottom rather than pretending they are zero. Deduplication can keep either the first or the last occurrence of each line — which matters when the later copy is the one carrying the data you want. Optional passes trim surrounding whitespace and drop blank lines before anything else runs.