Text Tools
Sort Lines
Sort a list alphabetically A→Z or Z→A, or numerically from smallest to largest, ignoring upper/lower case.
About the Sort Lines
Sort Lines puts a list in order, A → Z or Z → A, by number, by length, in reverse, or shuffled at random. Options let you remove duplicates, drop blank lines, trim spaces, sort case-sensitively and number the result, all updating instantly.
What you can do with the Sort Lines
- Six sort orders: A → Z, Z → A, by number, by length, reversed or shuffled.
- Remove duplicates: Drop repeated lines and blank lines in the same step.
- Fine control: Trim spaces, sort case-sensitively and number the result.
- Instant: The sorted list updates as you change options.
Alphabetical sorting that ignores capitals
A basic computer sort orders text by character codes, which puts every capitalized word before every lowercase one, so "Zebra" would come before "apple". This tool uses language-aware comparison instead, so "apple" and "Apple" sit together and accented letters are placed next to their plain versions.
Natural number order
Sorted as plain text, "item 10" comes before "item 2", because "1" is compared before "2". With "Natural numbers" on, numbers inside lines are compared by value, so file names, chapters and invoice numbers come out in the order people expect. The 1 → 9 and 9 → 1 orders sort purely by the first number in each line, including decimals and negatives.
More ways to order
"Shortest first" and "Longest first" sort by line length, "Reverse order" flips the list as it is, and "Shuffle" puts it in random order, handy for picking a running order or randomizing a quiz.
Related tools
Frequently Asked Questions
Can Sort Lines remove duplicates?
Yes. Switch on "Remove duplicates". It ignores capitals unless "Case-sensitive" is also on.
Why were my blank lines removed?
"Drop blank lines" is on by default. Switch it off to keep empty lines in the result.
Can I sort names by surname?
Not directly, each line is sorted from its first character. If your list is "First Last", rewrite it as "Last, First" before sorting.
Why does "item 10" come before "item 2" when I sort?
That is plain character order, where 1 comes before 2. Keep "Natural numbers (2 before 10)" switched on, which it is by default, and digits are read as whole numbers, so item 2 comes before item 10 as you would expect.
How do I rank students or scores from highest to lowest?
Put one entry per line, such as "Priya 92", and choose 9 → 1. Lines are sorted by the first number found in each line, so "Priya 92, Rahul 85, Amit 78" comes out in that order. Lines with no number go to the end.
What is the difference between Z → A and Reverse order?
Z → A sorts the lines alphabetically from Z to A. Reverse order does no sorting at all; it simply flips your list so the last line comes first, which is handy for turning an oldest-first log into newest-first.
What does the Case-sensitive option change?
By default capitals are ignored, so "apple" and "Apple" sort together and count as duplicates. With Case-sensitive on, upper and lowercase versions are treated as different lines, so both are kept when you remove duplicates and they sort as separate entries.
Can I shuffle a list to pick a random order?
Yes. Choose Shuffle and the lines are put in a random order, which is useful for presentation turns, quiz questions or a simple lucky draw. Each shuffle is random, so the order will differ from one run to the next.
How can I number the sorted list?
Switch on "Number the lines" and each line of the sorted result gets a running number, so you can paste a ready-made ranked or ordered list into a document or message without numbering it by hand.
Can I sort lines by length?
Yes. "Shortest first" and "Longest first" sort by the number of characters in each line. Lines of equal length are then sorted alphabetically, so the result stays predictable, which helps when tidying keyword lists or checking which titles are too long.
Can I sort a column copied from Excel?
Yes. Copy a single column and paste it in; each cell becomes one line. Sort it, then copy the result back into the sheet. If you copy several columns, each row is sorted as one line by whatever text it starts with.
Related tools
- ROT13 Cipher, Encode or decode text with ROT13, the classic letter-shift cipher used to hide spoilers and puzzle answers.
- Shuffle Lines, Randomly reorder the lines of a list, useful for draws, quiz questions and fair turn orders.
- Add Line Numbers, Add 1, 2, 3… numbers to the start of every line in a block of text or code.
- Text to URL Slug, Turn a title into a clean, lowercase, hyphenated URL slug that search engines read well.
- Number to Words, Spell out any number in English words, e.g. 1,234 becomes one thousand two hundred thirty-four.
- Case Converter, Convert text to UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case or kebab-case.