Text Sorter — Sort lines and words A to Z, by length or by number.

Paste a list and sort it alphabetically, from Z to A, by length, by the number in each line, in reverse or in random order. Ignore case, use natural order so file2 comes before file10, trim spaces, and remove empty lines and duplicates. Everything runs in your browser, and your list is never uploaded.

Sort a list Sorted in your browser
Text sorter showing a list sorted A to Z

Your list

Paste a list to sort it.

Sorted result

0Items in
0Items out
0Duplicates removed
0Empty lines removed
The guide

Text Sorter Guide: Alphabetical, Natural, Numeric and Random Order

Learn what each sort order does, how natural order and case work, and how to clean a list while you sort it.

A simple explanation

What is a text sorter?

A text sorter puts the lines of a list in order. You paste the list, pick an order such as A to Z or longest first, and the sorted list appears straight away, ready to copy or download.

It can also remove duplicate lines and empty lines, ignore capital letters, put numbered items in natural order, or sort single words instead of whole lines. If your list has stray spaces or hidden characters, tidy it first with the Whitespace Remover, and use the Text Diff Checker to compare the sorted and original versions.

Common reasons to sort text

Why People Sort Text Online

Names, keywords and lists

Put a guest list, a keyword list or a glossary in alphabetical order and remove the repeats in one go.

Data and code

Sort imports, file names, IDs, log lines or CSV columns pasted as text, so they are easier to scan and compare.

Draws and random order

Shuffle a list to pick a running order, split teams or draw names fairly.

What each order does

A to Z, Length, Number, Reverse and Shuffle

A to Z and Z to A

Alphabetical order, forwards or backwards. The tool uses your browser’s language rules, so accented letters such as é sit next to e.

Shortest or longest first

Orders items by how many characters they have. Items of the same length keep the order they had before.

Number, low to high or high to low

Uses the first number found in each line, such as 12 in “Item 12”. Lines with no number go to the end.

Reverse current order

Flips the list without sorting it. The last line becomes the first.

Shuffle randomly

Puts the items in a random order using your browser’s secure random numbers. Press Shuffle again for a new order.

Sort in a few steps

How to Use the Text Sorter

  1. Paste your list into the box, one item per line, or press Sample to try an example.
  2. Choose whether to sort Lines or Words, then pick an order.
  3. Tick the options you need: ignore case, natural order, trim spaces, remove empty lines or remove duplicates.
  4. The sorted list updates as you type. Check the counts to see how many items, duplicates and empty lines there were.
  5. Press Copy result or Download .txt. Use “Use as input” to sort the result again with different settings.
Why “file10” can come before “file2”

Natural Order and Case, Explained

Plain A to Z Natural order file1.txt file1.txt file10.txt file2.txt file2.txt file10.txt Ignore case on: Apple and apple count as the same word for ordering Ignore case off: they stay separate, and the capital letter comes first

Plain alphabetical sorting reads digits one character at a time, so “10” lands before “2”. Natural order compares the whole number instead, which is what most people expect for file names, chapters and numbered lists. It is on by default and you can switch it off.

Ignoring case only changes how items that differ by capitals are treated. Either way the list follows alphabet order, not raw code order, so “banana” does not jump behind “Cherry”.

Better results

Simple Tips for Sorting Lists

  • Turn on Remove duplicates and Ignore case together to get a clean list of unique entries.
  • Use Trim spaces around lines if some entries start with a space, otherwise those lines sort to the top.
  • To sort by a number inside a line, such as a price or score, choose a Number order.
  • Choose Words to sort a sentence or a comma-separated list, then pick a comma and space as the separator.
Good to know

Limitations and Privacy

Privacy

Your list is sorted in your browser. It is never sent to our server. Only your sort order and option choices are remembered on your device, never the text itself.

Limitations

The tool handles up to about 5 million characters. It sorts whole lines or words, not columns inside a line. Alphabetical order follows your browser’s language settings, and some languages have special rules that can differ from a printed dictionary.

Common questions

Text Sorter FAQ

How do I sort a list alphabetically online?

Paste your list with one item per line and leave the order on A to Z. The sorted list appears on the right as you type. Press Copy result to use it.

How do I sort lines from Z to A?

Choose Z to A in the Order menu. The same options apply, including ignoring case, natural order and removing duplicates.

What does natural order do?

It compares whole numbers inside text, so file2 comes before file10. Without it, plain alphabetical sorting puts file10 before file2 because it reads one digit at a time.

How are numbers sorted?

Choose a Number order. The tool uses the first number it finds in each line, including decimals and thousands commas, and sorts by that value. Lines without a number go to the end.

Does it ignore upper and lower case?

Yes, by default. Apple and apple are treated as equal for ordering and keep their original order. If you turn it off, items that differ only by case stay separate and the capital letter comes first.

Can it remove duplicate lines?

Yes. Tick Remove duplicates and only the first copy of each line is kept. The case option decides whether Apple and apple count as the same line. The tool shows how many were removed.

Can I sort words instead of lines?

Yes. Choose Words and the text is split on spaces and line breaks. You can join the sorted words with a space, a new line or a comma and space.

How does the shuffle work?

It uses a Fisher-Yates shuffle with your browser’s secure random numbers, so every order is equally likely. Press Shuffle again for a new random order.

Does it work with accented letters and other languages?

Yes. Sorting uses your browser’s language-aware comparison, so accented letters such as é sort next to e. Rules for some languages differ from a plain alphabet, and they follow your browser’s settings.

Is my text uploaded or stored anywhere?

No. Sorting happens in your browser and the tool handles up to about 5 million characters. Your order and option choices are remembered on your device, but the text is not saved.

From people using this tool

Reviews

Loading reviews…
Keep going

More tools in the box

The homepage features dozens more free tools that don't require an API key.

Suggest a tool