TextArray
100% local

Sort lines

Sort lines alphabetically, naturally, by length or by leading number.

Input
Output

Sort lines

Paste any list and this tool sorts its lines the way you choose. Six orders are available: classic A → Z and Z → A, a natural order that understands numbers inside text, shortest first, longest first, and a numeric order that reads the leading number of each line. Use it to alphabetise names, order keyword lists, arrange file names, rank measurement logs or tidy any list before sharing it.

Natural order is the one to pick when your lines contain numbers: it places file2 before file10, exactly as a person would, where a plain alphabetical sort puts file10 first because it compares character by character. Numeric order goes a step further — it parses the number at the start of each line ("12 apples", "-3.5 kg") and sorts by its value, moving lines without a leading number to the end.

Two switches control how lines are compared. Trim whitespace ignores leading and trailing spaces, so indented lines sort by their content. Case-insensitive treats "Apple" and "apple" as equal, keeping the comparison about words rather than capitalisation. Both are on by default because that is what most lists need; turn them off for a strict byte-by-byte view. Windows (CRLF) and Unix (LF) line endings are handled interchangeably.

Sorting happens entirely in your browser — the text is never uploaded, so private lists such as customer names or internal identifiers stay on your device. The tally under the output shows the line count and the active order, and the result updates live as you type.

FAQ

What is the difference between alphabetical and natural order?
Alphabetical order compares character by character, so file10 comes before file2. Natural order reads the numbers inside the text and puts file2 before file10, the way a person would sort them.
How does numeric order work?
It parses the number at the beginning of each line, including negative values and decimals, and sorts by that value. Lines that do not start with a number move to the end.
Does sorting change the lines themselves?
No. Trimming and case-insensitivity only affect how lines are compared — the output contains your original lines, just in a new order.
How are ties handled?
Lines that compare as equal keep their original relative order, and length-based orders fall back to alphabetical comparison for lines of the same length.
Is my list uploaded anywhere?
No. The tool runs entirely in your browser and your text never leaves your device.