Skip to content

Sort lines

Alphabetize a list, remove duplicates and clean up blank lines.

Updated

How to sort a list

  1. Paste your list, one item per line, or open a text or CSV file.
  2. Choose an order: alphabetical, natural, by length, or reversed.
  3. Turn on Remove duplicates to keep only the first copy of each line.
  4. Copy the result or download it.

Sort orders

OrderExample result
A → Zitem 1, item 10, item 2
Naturalitem 1, item 2, item 10
Shortest firstfig, kiwi, banana
Reverse orderThe list upside down, without sorting

Cleaning up a messy list

Lists copied from spreadsheets, emails or web pages often carry stray spaces, blank lines and repeats.Trim spaces and Remove empty lines are on by default, so pasting and sorting usually gives a clean list in one step. The summary under the result tells you how many lines were removed.

Common uses

  • Cleaning up an email list. Paste a column of email addresses, turn on Remove duplicates, and get each address once in alphabetical order.
  • Alphabetising names. Sort a list of attendees, products or references A to Z for a handout, a menu or the end of a document.
  • File names with numbers in them. Natural sort puts lists like chapter2, chapter10 in the order people expect, which helps when checking a folder of numbered files.
  • Finding the unique values in a column. Paste a column copied from a spreadsheet and remove duplicates to see each value once. The summary says how many repeats were removed.

Questions

What's the difference between A → Z and natural sort?

A → Z compares text character by character, so “item 10” comes before “item 2”. Natural sort reads numbers as numbers, so “item 2” comes before “item 10”, the order people expect.

Which copy of a duplicate is kept?

The first one, in the original order. With “Case-sensitive” off, “Apple” and “apple” count as the same line; turn it on to keep both.

How are accented letters sorted?

Alongside their base letter, as in a dictionary: “Éclair” sorts with the E words rather than after Z.

All text tools →