Skip to content

Sort Lines of Text

Paste a list and put it in alphabetical, numeric, length or random order in one click.

  • 100% free
  • Runs in your browser
  • Instant results
Quick answer

To sort lines of text, paste your list with one item per line and choose an order: A to Z, Z to A, by the number in each line, by line length, reversed or shuffled at random. The sorted list appears immediately. Options let you ignore letter case and remove empty or duplicate lines.

How to use the Sort Lines

  1. Paste your listPut each item on its own line. A column copied from a spreadsheet works as it is.
  2. Choose the orderPick alphabetical, numeric, by length, reversed or shuffled from the menu.
  3. Tidy as you sortUse the tick boxes to ignore capital letters, trim spaces and drop blank or duplicate lines.
  4. Copy the resultPress Copy to take the sorted list.

The sort orders explained

  • A to Z and Z to A: alphabetical order using your browser's language rules, so accented letters sort next to their plain versions (é beside e) instead of after z.
  • A to Z, numbers in order: also called natural sort. Plain alphabetical order puts "item 10" before "item 2" because it compares the characters 1 and 2. Natural sort reads the digits as whole numbers, so 2 comes before 10. Use it for file names, chapter titles and version numbers.
  • By number: sorts by the first number found in each line, including negatives, decimals and thousands separators such as 1,200. Lines with no number go to the end.
  • By length: orders by the number of characters in each line. Lines of equal length keep their original order.
  • Reverse: flips the list top to bottom without sorting.
  • Shuffle: puts the lines in random order with an unbiased Fisher-Yates shuffle. Every arrangement is equally likely.

With "Ignore upper and lower case" ticked, "apple" and "Apple" are treated as equal and "Banana" sorts between "apple" and "cherry". Untick it and capitalised words are placed ahead of their lowercase twins.

Common uses for sorting lines

People sort lines of text to alphabetise a bibliography, glossary or guest list, order a list of names for a register, rank scores or prices, find the longest headline in a batch, or shuffle a list of questions or raffle entries. Developers use it to order imports, CSS properties and configuration keys so that changes are easier to review.

Sorting and cleaning go together, so three clean-up options are built in. Blank lines are removed by default because they would otherwise all collect at the top of the list. Tick "Remove duplicate lines" to keep one copy of each item; for more control over duplicates, use the dedicated remove duplicate lines tool. When the order is right, add line numbers turns the list into a numbered one.

The list is sorted in your browser and is never uploaded. Lists with tens of thousands of lines sort in a fraction of a second.

Frequently asked questions

How do I sort lines alphabetically?

Paste your list with one item per line and leave the order on "A to Z". The sorted list appears below straight away. Choose "Z to A" for reverse alphabetical order.

Why does 10 come before 2 when I sort?

Alphabetical sorting compares text one character at a time, and the character 1 comes before 2. Choose "A to Z, numbers in order" or "By number" to sort by numeric value instead.

Is the shuffle really random?

It uses the Fisher-Yates algorithm with your browser's cryptographic random number generator, so every possible order is equally likely. Press the button again for a new order.

How are accented letters and other languages sorted?

The tool uses the language-aware comparison built into your browser. Accented letters sort beside their base letters, and other alphabets follow their usual order.

Can I sort by a column in the middle of each line?

Not directly. Numeric sorting uses the first number in each line, and alphabetical sorting starts at the first character. For multi-column data a spreadsheet is the better tool.

Last updated 24 November 2026 by the TheTechFolk team.