Guide
How to Sort Lines Alphabetically, Numerically and by Length
Understand the different ways to sort a list of lines and how to choose the right mode for names, numbers and data.
A sort-lines tool reorders the lines of a text block according to a rule you choose — alphabetical, numerical, by length, or reverse. It turns a random list into something you can scan, compare, and import.
Sorting modes explained
- Alphabetical A→Z — dictionary order, case-insensitive by default.
- Alphabetical Z→A — reverse dictionary order.
- Numerical — sorts by the leading number on each line (10 comes after 9, not after 1).
- By length — shortest to longest, or vice versa.
- Random / shuffle — reorders lines with no pattern.
- Reverse — flips the current order without sorting.
Choosing the right mode
Use alphabetical for names, titles, and words. Use numerical only when each line begins with a number — alphabetical sort would put "10" before "2" because it compares character by character. Use length sort when you want short entries first (e.g. two-letter words) or longest first (e.g. highest-scoring plays).
How to sort a list
- Paste your list, one item per line.
- Pick the sort mode that matches your data.
- Optionally remove blank lines and deduplicate in the same pass.
- Copy the sorted result.
Examples
Lines "10 apples", "2 bananas", "1 cherry" sort alphabetically as "1 cherry", "10 apples", "2 bananas" — clearly wrong for numbers. Switch to numerical sort and you get "1 cherry", "2 bananas", "10 apples" — the intended order.
When sorting lines is useful
- Alphabetising name lists, glossaries, and bibliographies.
- Ordering numbered items or ranked data.
- Grouping words by length for word games.
- Preparing sorted data for import or display.
Put it into practice
Use the Sort Lines right now — free, in your browser, no sign-up required.
Try the Sort LinesMore guides
- How to Unscramble Letters Into Words
- How to Find Anagrams of Any Word
- How to Count Words, Characters and Reading Time Accurately
- How to Find Words by Pattern, Length and Letters
- How to Use a Random Word Generator for Games, Writing and Brainstorming
- How to Count Characters (With and Without Spaces)
- How to Convert Text Between Cases (UPPER, lower, Title, camelCase and More)
- How to Clean Up Messy Text (Spaces, Line Breaks and Whitespace)
Related free tools
More free online utilities that pair well with this one — same-category tools for the same task, plus handy extras from other categories.
More words & text tools
You might also need
- Base64 Encoder / DecoderConvert plain text or images to Base64 strings
- Hash GeneratorGenerate MD5 & SHA-256 hashes from text
- HTML / CSS MinifierStrip whitespace and line breaks to compress code
- Lorem Ipsum GeneratorGenerate placeholder Lorem Ipsum text
- QR Code GeneratorTurn any link or text into a QR code