Sort Lines
Sort text lines alphabetically, numerically, by length, or randomly. Remove duplicates and empty lines. Free online line sorter with instant results.
How the Sort Lines Tool Works
Paste any multi-line text and sort it instantly using several different modes. Choose alphabetical (A-Z or Z-A), numerical, by line length, or random order. You can also remove duplicate lines and trim whitespace in a single step.
The tool processes your text entirely in the browser. Nothing is uploaded or stored. Paste your data, pick a sort mode, and copy the sorted result. It handles thousands of lines without any delay.
Sort Modes Explained
Alphabetical sorting arranges lines from A to Z (or reversed). It is case-insensitive by default, so 'apple' and 'Apple' are treated as equal. Numerical sorting compares lines by their leading number, which is useful for data like '10 items' or '2.5kg'. By-length sorting orders lines from shortest to longest.
Random sorting shuffles all lines into a completely random order, useful for randomising lists. The deduplicate option removes exact duplicate lines while preserving the first occurrence of each unique line.
Sort Mode Examples
| Mode | Input | Output |
|---|---|---|
| Alphabetical (A-Z) | Banana, Apple, Cherry | Apple, Banana, Cherry |
| Alphabetical (Z-A) | Banana, Apple, Cherry | Cherry, Banana, Apple |
| Numerical | 10 cats, 2 dogs, 5 birds | 2 dogs, 5 birds, 10 cats |
| By length (short first) | Hi, Hello, Hey | Hi, Hey, Hello |
| Random | A, B, C, D | C, A, D, B (varies) |
Frequently Asked Questions
Can I sort a CSV column?
Yes. Copy the column of data you want to sort (one value per line) and paste it into the tool. Sort it, then paste it back into your spreadsheet. For full CSV manipulation, a spreadsheet may be more appropriate.
Does it remove blank lines?
The trim whitespace option removes leading and trailing spaces from each line. Combined with deduplication, it effectively cleans up messy lists. Completely empty lines can be filtered out as part of the process.
How does numerical sorting differ from alphabetical?
Alphabetical sorting treats '10' as coming before '2' because '1' comes before '2' character by character. Numerical sorting understands that 2 is less than 10, giving you the correct numeric order. Always use numerical sorting when your lines start with numbers.
Related Tools
Remove Duplicate Lines
Remove duplicate lines from text with options for case sensitivity, whitespace trimming and sorting. Shows duplicate count and stats
Word Counter
Count words, characters, sentences and paragraphs in your text. Includes reading time, speaking time and word frequency analysis.
Word Randomizer
Shuffle and randomize the order of words in any text. Choose separator, preserve line breaks, and reshuffle as many times as you like.
Related Tools
Remove Duplicate Lines
Remove duplicate lines from text with options for case sensitivity, whitespace trimming and sorting. Shows duplicate count and stats
📝 Text ToolsWord Counter
Count words, characters, sentences and paragraphs in your text. Includes reading time, speaking time and word frequency analysis.
📝 Text ToolsWord Randomizer
Shuffle and randomize the order of words in any text. Choose separator, preserve line breaks, and reshuffle as many times as you like.
📝 Text Tools