Free Tools
Blog

How to Sort a List Alphabetically, Numerically or Naturally

By Admin Editor · September 22, 2026

Sorting a list sounds like the simplest job on a computer — until "file10" lands before "file2" and your numbers come out in a strange order. Knowing which kind of sort to use fixes it.

A Rolodex with alphabet tabs on a desk

Alphabetical sorting

Alphabetical (or lexicographic) sorting compares text character by character, like a dictionary: apple, banana, cherry. It's what you want for names, words and most text.

Two options change the result:

  • Case sensitive or not. Case-insensitive sorting treats "apple" and "Apple" as equal. Case-sensitive sorting (in plain character order) puts all capitals before lowercase letters.
  • Ascending or descending. A to Z, or Z to A.

The natural sorting problem

Plain alphabetical sorting compares characters one at a time, so it reads "10" as "1" then "0":

  • file1
  • file10
  • file2

That's technically correct for text but wrong for humans. Natural sorting compares the numbers inside text by their value:

  • file1
  • file2
  • file10

Use natural sorting for file names, version labels, chapter titles and anything with numbers embedded in text.

Numeric sorting

If each line starts with a number, sort by that number's value, so 9 comes before 10 and negative numbers and decimals are ordered correctly. Lines that don't start with a number are placed after the numbers.

Sorting by length

Sorting by line length puts the shortest lines first (or last). It's handy for spotting outliers such as unusually long entries or one-character mistakes.

A tidy desk with files and a plant

How to sort your list

  1. Paste your list into the Sort Lines tool, one item per line.
  2. Choose the sort type — alphabetical, natural, numeric or length — and ascending or descending.
  3. Optionally tick "Remove duplicate lines" and "Remove empty lines" to clean up in the same step.
  4. Copy or download the result.

The sort is stable, meaning lines that compare as equal keep their original order. Everything runs in your browser.

Everyday uses

  • Alphabetising names, tags, keywords or a glossary.
  • Putting file lists into sensible order.
  • Sorting numbered data.
  • Preparing lists for comparison — sorted lists are much easier to compare by eye.

FAQ

Why does 10 come before 2 when I sort? Text sorting compares character by character. Use natural or numeric sorting instead.

How do I sort Z to A? Choose descending order.

Will sorting remove duplicates? Only if you tick "Remove duplicate lines". To dedupe while preserving order, use Remove Duplicate Lines.

Try it now

Open the free Sort Lines tool.

Related reading

See Text Case Styles Explained and How to Remove Duplicate Lines From a List. Browse the full blog for more guides.