Sort Lines

Sort lines in ascending or descending text order.

Your workspace

Processed in your browser

Enter your values or try the example.

This tool organizes your text by sorting lines based on their content. It uses natural sorting, which correctly handles numbers within text strings (e.g., 'item 2' comes before 'item 10').

How to sort lines

  1. Paste the text you want to organize into the input area, with each item on a new line.
  2. Select 'Ascending' or 'Descending' order and view the sorted output immediately.

Natural Sorting Behavior

The tool employs natural sorting, which is distinct from standard lexicographical sorting. In standard sorting, '10' might appear before '2' because '1' comes before '2'. Natural sorting recognizes '2' as a smaller number than '10', ensuring that numbered lists appear in a logical sequence. This is particularly useful for file names, version numbers, or inventory lists.

Sorting a numbered list

Item 10 Item 2 Item 1

Item 1 Item 2 Item 10

Sorting questions

Does this tool handle empty lines?

Yes, empty lines are treated as empty strings and will be sorted along with your content, typically appearing at the top or bottom depending on the order.

How does it handle case sensitivity?

The sorting logic uses standard locale-based comparison, which generally treats uppercase and lowercase letters as equivalent for sorting purposes unless they are otherwise distinct.

Continue your workflow

Explore more tools in this category for your next step.