Text
Sort lines
Paste a list and sort it A to Z, Z to A, by number or by line length, with an option to drop empty lines. The result is a text block you can copy.
Runs locally in your browser
How it works
The text is split on line breaks, and one trailing line break counts as an ending rather than a blank line. A to Z compares whole lines character by character, so digits sort before capitals because the code for 1 is lower than the code for A, and Z to A reverses that order. Numeric sorting parses each line as a number and pushes lines that are not numbers to the end in their original order, with a warning that counts them. Sorting by length compares character counts and keeps the original order between equal lengths. The remove-empty option drops blank lines before any sort. Input is capped at 50,000 characters and 5,000 lines.
Worked example
The four lines pear, Apple, 10 and banana sort to 10, Apple, banana, pear from A to Z, because digits are coded lower than capitals, and to pear, banana, Apple, 10 from Z to A. By length they become 10, pear, Apple, banana, since 10 has 2 characters, pear has 4, Apple has 5 and banana has 6. A numeric sort of 10, -2 and 3.5 gives -2, 3.5, 10, and any word left in that list is named in a warning instead of being sorted by mistake.
Questions and answers
Everything runs in your browser: your text, file or value is never uploaded anywhere.