--- title: "Sort lines alphabetically — free, runs in your browser" description: "Sort a list of lines A–Z, Z–A, by length, or numerically. Free, no sign-up, and nothing you enter leaves your browser." url: https://atoneplace.net/tools/sort-lines/ site: "At One Place" --- # 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](https://atoneplace.net/tools/word-counter/) - [Typing speed test](https://atoneplace.net/tools/typing-speed-test/) - [Remove duplicate lines](https://atoneplace.net/tools/remove-duplicate-lines/) - [JSON formatter and validator](https://atoneplace.net/tools/json-formatter/) - [Text compare](https://atoneplace.net/tools/text-diff/) - [Regex tester](https://atoneplace.net/tools/regex-tester/) - [Case converter](https://atoneplace.net/tools/case-converter/) - [Remove empty lines](https://atoneplace.net/tools/remove-empty-lines/) - [Find and replace](https://atoneplace.net/tools/find-and-replace/) - [Readability checker](https://atoneplace.net/tools/readability-checker/)