Boneyard Tools

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

  1. Paste your list into the 'Your list' box, one item per line.
  2. Use the Ascending / Descending toggle to choose the direction.
  3. Tick 'Numeric sort' for lists of numbers so 10 comes after 2 instead of before it.
  4. Tick 'Case sensitive' to separate uppercase from lowercase, or 'Remove duplicates' to keep one of each line.
  5. 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

Related tools