Skip to main content
Premier SEO Services

Text tools

Sort Text Lines

Put a list in alphabetical, reverse or natural number order, or sort it by line length, with options to sort by surname, remove duplicates or shuffle.

  • Runs in your browser
  • Free, no sign-up
  • Unlimited use
  • Updated 30 September 2026

Sort Text Lines

Paste your text — the result updates as you type

How to use the sort text lines

  1. 1Paste your list into List to sort (one item per line).
  2. 2Choose an Order, such as A → Z (alphabetical) or Natural: 2 before 10.
  3. 3Tick Remove duplicates or Sort by the last word (surnames) if you need them.
  4. 4Copy the result from Sorted list.

Example

Input
file10.txt
file2.txt
File1.txt
file1.txt
Output
file1.txt
File1.txt
file2.txt
file10.txt

Setting: Natural: 2 before 10. With A → Z the order is file1.txt, File1.txt, file10.txt, file2.txt, because text is compared one character at a time and “1” comes before “2”.

Alphabetical and reverse order

A → Z sorts the way a dictionary does: capital and small letters sort together, and accented letters sit next to their plain letters (é with e). When two lines differ only in case, the lowercase one comes first. Z → A is the exact reverse.

Tick Case-sensitive (capitals first) to sort by character code instead, the way many programming languages do: all capitals come before all lowercase letters, so “Zebra” sorts before “apple”.

Natural sort for numbers

Normal alphabetical sorting compares text character by character, so “10” comes before “2” (because “1” is less than “2”). Natural: 2 before 10 reads runs of digits as whole numbers: file2 before file10, Chapter 9 before Chapter 11. Use it for file names, version numbers, chapter lists and anything numbered. Natural, reversed gives the opposite order.

Sorting by length

Shortest line first and Longest line first order lines by the number of visible characters, counting an emoji or accented letter as one. Lines of equal length are sorted alphabetically. Sorting by length helps when writing headlines and taglines, or when checking a keyword list for overly long phrases.

Ignoring case

Case is ignored by default for ordering and for Remove duplicates, so “Apple” and “apple” count as the same item and the first one is kept. With Case-sensitive (capitals first) ticked, they count as different. Remove empty lines (on by default) drops blank lines before sorting so they don't collect at the top.

Random shuffle

Random shuffle puts the lines in random order using your browser's cryptographically secure random generator and the Fisher–Yates method, so every order is equally likely. The list is shuffled again each time you edit it or change an option. To pick one or more winners from a list instead, use the random line picker. Reverse the current order flips the list upside down without sorting.

Is my text private?

This tool runs entirely in your browser. Your text is not uploaded to our servers.

Questions about the sort text lines

How do I alphabetize a list?

Paste it with one item per line and keep A → Z (alphabetical), the default. The sorted list appears straight away.

Why does 10 sort before 2?

Alphabetical sorting compares one character at a time, and “1” comes before “2”. Choose Natural: 2 before 10 to sort numbers by their value.

Can I sort by last name?

Yes. Tick Sort by the last word (surnames); “Ada Lovelace” is then sorted under L. Names with particles such as “van Gogh” sort under the last word, Gogh.

Last updated 30 September 2026Maintained by Premier SEO Services

Report a problem