Sort lines alphabetically
Sort a list of lines A–Z, Z–A, by length, or numerically.
How it works
Sorts pasted lines. Alphabetical sorting uses your locale’s collation rules rather than raw character codes, so accented characters land where a person would expect them rather than after Z.
Numeric sort is the one worth knowing about. A plain alphabetical sort puts 10 before 2, because it compares character by character and "1" comes before "2". Numeric mode reads the leading number on each line and orders by value, which is what you want for anything with figures in it.
Natural sort splits the difference: it handles text with embedded numbers, so file2 comes before file10 rather than after it.
This tool runs entirely in your browser. Nothing you enter is sent to a server, logged or stored, and the page keeps working with the network disconnected.
Common questions
- Why is 10 sorting before 2?
- Alphabetical sorting compares one character at a time, and "1" comes before "2". Switch to numeric or natural sort to order by value.
- What is natural sort?
- It treats runs of digits as numbers, so file2 comes before file10 instead of after it. Ordinary alphabetical sort gets this backwards.
Related pages
- Word and character counter Words, characters, sentences, paragraphs and reading time, counted as you type.
- Typing speed test Measure words per minute and accuracy on a one, two or five minute test.
- Remove duplicate lines Strip repeated lines from a list, keeping the first occurrence of each.
- JSON formatter and validator Pretty-print, minify and validate JSON, with the exact position of any error.
- Text compare Compare two blocks of text and see which lines were added, removed or changed.
- Regex tester Test a regular expression against sample text, with matches and capture groups shown.
- Case converter Convert text between upper, lower, title, sentence, camel, snake, kebab and other cases.
- Remove empty lines Delete blank lines from a block of text, optionally collapsing runs to one.
- Find and replace Replace every occurrence of a string in pasted text, with optional regex.
- Readability checker Flesch Reading Ease and grade level, with sentence length and passive voice flagged.