Sort Lines
Sort a list A to Z, naturally, by number or by length, reverse it or shuffle it, and drop duplicates.
Runs in your browser. Nothing is uploaded.
Updated
How to use Sort Lines
- Paste one item per line.
- Choose the order and options such as Remove duplicates.
- Sort, then copy or download the list.
Sort Lines at a glance
Typical use: Put 300 product names in alphabetical order and remove the repeated ones.
Runs in your browser; nothing is uploaded. Exact order matches GNU sort in the C locale; numeric order matches sort -n.
When to use Sort Lines
Alphabetize a list of names, products or keywords; put numbered items in order; find the longest lines; shuffle a list for a draw; or tidy a list by removing duplicates and empty lines in the same step.
Which order to choose
- A to Z: dictionary order. Upper and lower case and accents don’t split the list: “apple”, “Apple”, “Banana”, “éclair”, “zebra”.
- Natural: numbers inside text count by value, so “Chapter 2” comes before “Chapter 10” (A to Z would put 10 first).
- By number: by the number at the start of each line (“12 apples”, “-3”, “2.5”). Lines without a number count as 0, as in
sort -n. - Exact: character codes, as computers sort: all capitals before small letters (“Zebra” before “apple”). Matches
LC_ALL=C sort. - By length: shortest first; Shuffle: a random order each time.
Sort Lines example
This list, in Natural order with “Remove duplicate lines” and “Treat Apple and apple as duplicates” ticked:
banana → apple
apple banana
Cherry Cherry
Apple item 2
item 10 item 10
item 2A to Z gives the same list, except that “item 10” comes before “item 2”.
Prefer the terminal?
The same sort with GNU sort:
sort -f names.txt # A to Z, ignoring case
sort -n -r prices.txt # by number, largest first
sort -V files.txt # natural: file2 before file10
sort -u list.txt # and remove duplicatessort’s order depends on your locale; LC_ALL=C sort gives the byte order this page calls “Exact”. sort -V is close to Natural but not identical for text with dots and dashes.
Frequently asked questions
How do I sort a list alphabetically?
Paste one item per line, keep “A to Z (ignore case)” and press Sort lines. Tick Reverse for Z to A.
Why does 10 come before 2?
Alphabetical order compares character by character, and “1” comes before “2”. Choose Natural to sort numbers inside text by value, or By number when each line starts with a number.
Can it remove duplicates without sorting?
Text Cleanup removes duplicates and keeps the original order. Here, duplicates are removed and the rest is sorted.
Is the order the same as Excel or the sort command?
A to Z is close to Excel’s order. Exact matches LC_ALL=C sort, and By number matches sort -n, both checked against GNU sort. Lines that are equal keep their original order.
How long can the list be?
Up to 5 million characters, sorted in your browser; nothing is uploaded.