Skip to content

Sort Lines

Sort text lines A to Z, Z to A, by number or by length, reverse or shuffle. Free online line sorter, runs in your browser.

How to use the sort lines

  1. Paste one item per line.
  2. Pick a sort order.
  3. Copy the sorted result.

About this tool

Paste a list and sort it alphabetically, in reverse, by number, or by line length. A to Z uses natural ordering, so item2 comes before item10. You can also reverse the order or shuffle randomly, and drop blank lines.

Natural sorting

Plain alphabetical sorting puts item10 before item2, because it compares one character at a time. A to Z here uses natural ordering, so item1, item2, item10 come out in the order people expect, and the same applies to file names with numbers.

The sort modes

Tips

Run the list through Remove Duplicate Lines after sorting to get a clean, unique, ordered list. Tick Remove empty lines to drop blanks. Sorting follows your browser language settings for accented letters, so the order of non-English text can differ slightly between devices.

What it cannot do

It sorts whole lines, not columns. Sorting a list of IP addresses works only partly, because each part is compared as a number in sequence, so for strict IP order use a dedicated tool. Dates in a day-month-year format sort as text, so convert them to year-month-day first.

Frequently asked questions

Does it sort numbers correctly?

A to Z uses natural ordering, so item2 comes before item10. Numbers up and down sort by the first number in each line.

Can I sort and remove duplicates?

Yes. Sort here, then paste into the remove duplicates tool.

Is my list uploaded?

No. Everything runs in your browser. Nothing is uploaded.

How do I sort a list alphabetically in Excel?

Select the column and use Data, then Sort A to Z. This page is quicker when your list is not in a spreadsheet.

Does shuffle give a fair result?

Yes. It uses a standard Fisher-Yates shuffle with a cryptographic random source, so every ordering is equally likely.

More text tools

Related tools