Sort Lines Alphabetically

Paste one item per line, choose the order and sort type, and press Sort lines. Natural sorting keeps numbered items such as file2 and file10 in the order people expect.

Try an example

About this line sorter

This tool puts lines of text in order: names, keywords, file names, CSV rows, or any list with one item per line. Alphabetical sorting follows the rules of your browser’s language, so accented names such as Émile sit next to Emma instead of after Z. Natural sorting treats numbers inside text as numbers, so report-2 comes before report-10. You can also sort by line length or by the first number in each line, reverse any order, and remove duplicates and empty lines in the same step.

How to sort lines

  1. Paste your list. Put one item per line, or press an example. An example only fills the box.
  2. Choose order and type. Pick ascending or descending, and alphabetical, natural, by length, or by number.
  3. Set the clean-up options. Ignore case, remove duplicates, remove empty lines, or trim spaces as needed.
  4. Press Sort lines. Copy the sorted list or download it.

Frequently asked questions

What is natural sorting?

Plain alphabetical sorting compares text character by character, so "file10" comes before "file2" because 1 is less than 2. Natural sorting reads the digits as whole numbers, giving file1, file2, file10.

How are accents and capital letters sorted?

With Ignore case on, capitals and accents do not change the order, so apple, Apple, and Éclair sort as if they were plain letters. With it off, uppercase comes before lowercase when two lines are otherwise equal.

How does sorting by number work?

Each line is sorted by the first number it contains, including negative numbers, decimals, and numbers with thousands commas such as 1,200. Lines without a number go to the end in both directions.

What does By line length do with equal lengths?

Lines of the same length are sorted alphabetically among themselves, so the result is always the same for the same input.

Are duplicate lines compared with Ignore case?

Yes. With Ignore case on, "Apple" and "apple" count as duplicates and only the first one is kept.