Sort Lines of Text
Paste a list, one item per line, and this tool sorts the lines alphabetically or by number. Toggle ascending or descending order, and switch on numeric sort, case sensitivity, or duplicate removal as needed. The sorted output and a live line count appear below, ready to copy.
How to sort lines of text
- Paste your list into the 'Your list' box, one item per line.
- Use the Ascending / Descending toggle to choose the direction.
- Tick 'Numeric sort' for lists of numbers so 10 comes after 2 instead of before it.
- Tick 'Case sensitive' to separate uppercase from lowercase, or 'Remove duplicates' to keep one of each line.
- Check the line count under Result and press Copy to grab the sorted list.
Examples
Alphabetize a list (ascending)
banana apple cherry
apple banana cherry
Numeric sort keeps values in order
10 2 1
1 2 10
Numeric sort pushes non-numbers to the end
3 apple 1
1 3 apple
Frequently asked questions
How is numeric sorting different from alphabetical?
Alphabetical sorting compares text character by character, so '10' lands before '2' because '1' comes before '2'. Numeric sorting reads the start of each line as a number, so 2 comes before 10. Turn on 'Numeric sort' whenever your lines are numbers.
Does sorting ignore upper and lower case?
By default it does, so 'apple' and 'Apple' group together as if identical. Turn on 'Case sensitive' to treat uppercase and lowercase as distinct. The comparison is locale-aware, so accented and mixed-case text sorts in a natural order.
Can I sort in reverse order?
Yes. Choose Descending to sort Z to A, or from highest to lowest number when numeric sort is on. The direction applies on top of whichever sort mode you have selected.
Can it remove duplicate lines while sorting?
Yes. Tick 'Remove duplicates' and repeated lines are dropped after sorting, leaving one of each. With case sensitivity off, 'Apple' and 'apple' count as the same line and only the first is kept; with it on, they are treated as different.
What does numeric sort do with lines that are not numbers?
It reads the leading number of each line, so '42 apples' sorts as 42. Lines with no leading number, like 'apple', are moved to the end of the list in their original relative order rather than being dropped.
How are line endings and a trailing newline handled?
Windows CRLF, classic Mac CR, and Unix LF endings are all recognized. A single trailing newline at the very end is ignored so it does not turn into a stray empty line in the output.
Is there a limit on how many lines I can sort?
There is no fixed cap. Sorting happens in your browser, so the practical limit is your device memory, and lists of thousands of lines sort effectively instantly.
Does it change the lines themselves?
No. Sorting only reorders and optionally de-duplicates whole lines. The text within each line, including its spaces and punctuation, is left exactly as you pasted it.
Is my text private?
Yes. Sorting runs entirely in your browser and nothing is uploaded to a server, so even long or sensitive lists never leave your device.
Learn more
- Alphabetical vs numeric sorting: why 10 can come before 2
Why text sorting puts 10 before 2, how numeric sorting fixes it, and how case, locale, and duplicates change the order of a list.
Related tools
Remove Duplicate Lines
Remove duplicate lines from text online and keep the first of each. Options for case sensitivity and trimming whitespace. Free, instant, and private.
Remove Line Breaks
Remove line breaks and paragraph breaks from text online. Flatten copied text into one line, keep spaces tidy, then copy the result. Free and private.
Acronym Generator
Turn any phrase into an acronym from the first letter of each main word. Skip small words like the and of, keep them, or add dot separators.
Add Line Numbers
Add line numbers to any text online. Set the start value, step, and separator, pad numbers to align, and copy or download the result. Free and private.
AI Sentiment Analyzer
Analyze the sentiment of any text with AI in your browser. Paste a review or comment, get a positive or negative score plus a per-sentence breakdown.
AI Text Summarizer
Summarize any text with AI, right in your browser. Paste an article, pick a length, and get a short abstractive summary. Nothing is uploaded.