Sort Lines

Sort lines alphabetically, numerically or reverse them.

About the Sort Lines tool

Sort Lines puts a list into order instantly. Alphabetical sorting uses natural ordering (so "Chapter 2" precedes "Chapter 10"), numeric sorting reads the number in each line, and length sorting is useful for finding the longest or shortest entries. You can also reverse a list or shuffle it randomly, which is handy for drawing names or randomising quiz questions.

Common uses include ordering bibliography entries, tidying import statements or CSS properties, ranking numbers copied from a report, and organising to-do lists or inventories exported from other apps.

How to use the Sort Lines

  1. Paste the lines you want to sort into the input box.
  2. Pick a sort order: alphabetical (A-Z or Z-A), numeric, by line length, reverse the current order, or shuffle randomly.
  3. Tick "Ignore case" or "Remove empty lines" if needed, then click Sort and copy the result.

Frequently asked questions

What is the difference between alphabetical and natural sort?

Alphabetical sort compares character by character, so "item10" comes before "item2". This tool uses natural ordering, which understands numbers inside text and puts "item2" before "item10", the way a person would.

How does numeric sort handle lines that are not numbers?

Each line is parsed for the first number it contains. Lines without any number are treated as zero and placed together at the start (ascending) or end (descending).

Does sorting remove duplicates?

No, sorting keeps every line. Use the Remove Duplicate Lines tool first if you also want to dedupe the list.

Can I sort a CSV column?

Yes. Paste the column so each value is on its own line, sort it, and paste the result back into your spreadsheet.