D

Sort Lines

Sort lines alphabetically, numerically, in reverse, or shuffle randomly — with duplicate removal.

Runs 100% in your browser — nothing is uploaded

About this tool

The Sort Lines tool takes multi-line text and sorts each line according to your chosen mode: alphabetical ascending or descending, numeric ascending or descending, reverse order, or random shuffle. You can also remove duplicate lines in a single operation.

Common uses: sorting a list of names or items for a template, removing duplicate entries from exported lists, normalizing the order of import statements, organizing configuration values, or shuffling a list for a random drawing.

Frequently asked questions

How does numeric sorting work?
Each line is parsed with parseFloat(). Lines that cannot be parsed as numbers are sorted as NaN and typically appear at the end. For purely numeric lists, this gives natural numeric ordering rather than lexicographic (where "10" < "9" alphabetically).
Does duplicate removal preserve order?
Duplicate removal uses a Set, which preserves first-occurrence order in JavaScript. The first occurrence of each line is kept; later duplicates are removed.