Skip to content
DayUtils

Sort Lines – Alphabetize, Sort by Number or Shuffle a List

Paste a list and sort it in one click: alphabetical A to Z or Z to A, natural order where “item 2” comes before “item 10”, by the number in each line, by length, in reverse order, or shuffled randomly. Accented letters sort correctly, and blank lines can be removed.

Loading tool…

How to use sort lines

  1. Paste your list into the box, one item per line.
  2. Choose how to sort:
    • A → Z (natural) — alphabetical, with numbers in order.
    • A → Z (alphabetical) — strict alphabetical order.
    • Z → A — reverse alphabetical.
    • By number — by the first number found in each line.
    • By length — shortest lines first.
    • Reverse the order — flip the list as it is.
    • Shuffle randomly — mix the lines up.
  3. Choose whether sorting is case-sensitive and whether to remove empty lines.
  4. Copy the result or download it.

Example

This list:

Zanzibar
nairobi
Accra
item 10
item 2
Lagos
item 1

sorted A → Z (natural) becomes Accra, item 1, item 2, item 10, Lagos, nairobi, Zanzibar.

Choosing the right sort

  • Names and words: alphabetical. Natural and plain alphabetical give the same result when there are no numbers.
  • File names, versions and chapters (“chapter 9”, “chapter 10”): natural sort.
  • Prices, scores and quantities: sort by number.
  • Tags or keywords: sort by length to spot very long or short entries.
  • Random order for quizzes, draws, playlists or seating plans: shuffle.

Common uses

  • Alphabetizing a bibliography, glossary or index.
  • Tidying a list of names for a class, team or event.
  • Ordering keywords or tags for review.
  • Sorting a list of URLs or file names.
  • Randomizing questions or presentation order.

Tips

  • Remove duplicates afterwards with remove duplicate lines.
  • Clean the text first with remove extra spaces — a leading space can make an item sort before everything else.
  • For tables, sort in a spreadsheet so each row stays together; this tool sorts whole lines as text.
  • Lines starting with symbols or numbers come before letters in alphabetical sort.

Sorting in other tools

Spreadsheets can sort a column with the Sort A–Z button, and most code editors have a “sort lines” command. This tool is handy when you’re working with text that isn’t in a spreadsheet — a list in an email, a document or a chat — or when you need natural or numeric sorting that a simple sort button doesn’t offer. Because it runs in your browser, you can also use it on a phone without installing anything. Paste, sort, copy and you’re done.

How language-aware sorting works

Computers store letters as numbers, and simple sorting by those numbers puts all capital letters before small letters and accented letters after Z. Language-aware sorting, called collation, follows the rules people expect: “é” sorts with “e”, and case is ignored unless you ask for it. This tool uses the collation built into your browser, which follows the Unicode standard.

Use text compare to see how two sorted lists differ, or find and replace to standardise entries before sorting.

Frequently asked questions

How do I alphabetize a list?

Paste the list, one item per line, and choose “A → Z”. The sorted list appears instantly. Copy it or download it as a text file.

What is natural sort?

Natural sort treats numbers inside text as numbers, so “item 2” comes before “item 10”. Plain alphabetical sorting would put “item 10” first, because the character 1 comes before 2.

How does sorting by number work?

The first number in each line is used, ignoring commas used as thousands separators. Lines without a number go to the end. “$50” sorts before “$300” and “$1,200”.

Are capital and small letters sorted together?

Yes, by default “apple”, “Banana” and “cherry” sort in that order. Tick “Case-sensitive” to keep upper- and lowercase versions distinct.

How does shuffle work?

Shuffle uses a Fisher–Yates shuffle, which gives every order an equal chance. Change the shuffle number to get a different random order.

Do accented letters sort correctly?

Yes. Sorting uses your browser’s language-aware comparison, so “Émile” sorts with the E’s rather than after Z.

Last updated: