š Sort Lines
Sort and organize text lines alphabetically, numerically, or in reverse order. Perfect for organizing lists, managing data, and arranging text content. Supports ascending and descending sort options.
- Paste your text with one item per line
- Click "Sort Lines" to organize alphabetically
- Enable "Reverse Order" for ZāA sorting
- Blank lines are preserved in sorted output
- Sort is case-insensitive by default
- Statistics show total, blank, and content lines
š Examples:
Blank Lines: 0
Content Lines: 5
- Organize alphabetical lists and directories
- Sort contact or name lists
- Arrange data for reports or analysis
- Organize TODO lists or task priorities
- Sort product names or inventory items
- Organize server logs or error lists
- Create alphabetical indexes or catalogs
The sort is lexicographic, not numeric
Lines are compared as text, character by character, after both sides are lowercased:
lines.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
1, 2, 9, 10, 100 sorts as 1, 10, 100, 2, 9
Nothing is read as a number, so 10 lands next to 1 because both begin with the
character 1. The fix is to pad your figures to equal width - 001, 002, 010, 100 -
at which point alphabetical order and numeric order are the same thing. Comparison
uses localeCompare, your browser's own collation, so
éclair files beside eclair rather than after
zebra.
Case, blanks and the reverse switch
- Case is ignored for ordering, kept in the output. Apple, apple and APPLE end up adjacent, each still spelled as you typed it.
- Blank lines float to the top, since an empty string sorts before everything. A trailing newline in your input is one of them, so expect a gap above your first entry.
- Reverse Order flips the sorted list rather than running a separate Z-A comparison. Blank lines therefore move to the bottom, and lines that tie swap places.
- Duplicates are kept. Sorting only reorders; send the result through Remove Duplicate Lines if you want one of each.
"Smith and Smith
do not sit together. Clean the list up before sorting it.Frequently asked questions
Why does 10 come before 9 in my sorted list?
Because the comparison is alphabetical: it reads the first character of each line, and 1 comes before 9. Zero-pad the numbers to the same width and they will sort in true numeric order.
Is the sort case-sensitive?
No. Both lines are lowercased before comparison, so capitals do not jump to the top the way they do in a plain ASCII sort, where every uppercase letter ranks ahead of every lowercase one.
How do I sort a list alphabetically in Word or Excel?
Word has Sort on the Home tab under the paragraph controls; Excel uses Data, then Sort A to Z. Pasting the lines here is quicker for a list you are still drafting, and nothing about the text is altered.