Sort Lines

Sort lines alphabetically, numerically or in reverse order.

Alphabetizing a bibliography, ordering filenames, shuffling quiz questions so students can't compare answers - line sorting shows up in more jobs than you'd expect. Six methods cover the usual cases: A to Z, Z to A, shortest or longest first, numeric and random shuffle.

Sorting Options

  • A-Z (Ascending) - Standard alphabetical order. The most common choice for name lists and glossaries.
  • Z-A (Descending) - Reverse alphabetical. Useful when you need the last items first.
  • Numerical - Sorts lines by number value, not alphabetically. This means 2 comes before 10 (alphabetical sorting puts 10 first because "1" comes before "2").
  • Random - Shuffles lines into random order. Great for randomizing quiz questions or picking winners from a list.
  • Reverse - Flips the current order without sorting. Last line becomes first.

Natural Sort vs Regular Sort

Regular alphabetical sorting puts "file10" before "file2" because it compares character by character. Natural sorting understands numbers inside text and puts "file2" before "file10" like you'd expect. This tool supports natural sorting, which makes a huge difference when working with numbered file names or version numbers.

Who Uses This

Teachers alphabetize student name lists and reading logs. Developers sort import statements and config file entries. SEO professionals organize keyword lists exported from tools like Ahrefs or SEMrush. Data analysts sort log entries by timestamp. If you've ever manually rearranged a list in a spreadsheet, this tool does it faster.

How to Use

  1. Paste your text lines into the editor.
  2. Choose your sort method (A-Z, Z-A, numerical or random).
  3. Click Sort and the output appears instantly.
  4. Copy the sorted text.

Frequently Asked Questions

Is the sort case-sensitive?

By default, it's case-insensitive. "apple" and "Apple" are treated the same. You can toggle case-sensitive sorting if you need uppercase and lowercase items separated.

What is the difference between numerical and alphabetical sort?

Alphabetical sort compares characters one by one, so "10" comes before "2" (because "1" < "2"). Numerical sort compares actual number values, so 2 comes before 10 as expected. Use numerical sort for IDs, rankings and version lists.

Can I remove duplicates and sort at the same time?

Turn on the "remove duplicates" option before sorting and both happen in one pass - a clean, ordered list with no repeated entries.

Can I remove blank lines while sorting?

There's a remove-blank-lines option for exactly that. Pasted lists from spreadsheets, emails and copied tables almost always carry a few empty rows.

Does it handle comma-separated lists?

This tool sorts line by line. If your items are separated by commas on a single line, put each item on its own line first. You can use a find-and-replace to swap commas for line breaks.