RepeatText
Writing & List Tools

Text Sorter

Sort a list the way a person would expect: item 2 before item 10, and capital letters mixed in correctly.

Runs on your device. Nothing is uploaded.
Sort
Sorted
  1. Paste your list, one item per line.
  2. Tick remove empty lines, remove duplicates or trim spaces if needed.
  3. Choose A→Z, Z→A, shortest first, longest first, reverse or shuffle.
  4. Copy the sorted list.

This text sorter puts the lines of any list in order. Paste one item per line and pick a sort: A→Z or Z→A in natural order (so 2 comes before 10, and capitals don't jump to the top), shortest first, longest first, reverse the current order, or a fair shuffle. Three options can tidy the list at the same time: remove empty lines, remove duplicates and trim spaces. Then copy the result or clear the box.

If you only came to put names in alphabetical order: paste them, tap A→Z, copy. The rest of this page explains why the result looks "right" here when other tools sometimes get it oddly wrong.

file1, file10, file2: the problem with plain sorting

Most basic sorting compares text character by character using computer codes. That creates two strange results people run into all the time:

  1. "10" comes before "2", because the character "1" is smaller than "2".
  2. Every word starting with a capital letter comes before every lower-case word, because capitals have smaller codes.

Here's the same list sorted both ways:

Your listPlain character sortThis tool, A→Z (natural)
file1File3file1
file10file1file2
file2file10File3
File3file2file10

Natural order reads numbers inside the text as whole numbers, so 2 sits before 10, and it ignores upper and lower case while comparing. That's the order a person would write by hand, and it's what you want for chapter lists, roll numbers, file names, "Item 9 / Item 12" style product names and so on. Z→A uses the same rules, just backwards.

Every sort button, and when I'd reach for it

  • A→Z: names, glossaries, vocabulary lists, a bibliography you'll polish by hand later.
  • Z→A: the same lists, backwards, or to see the highest numbered items first.
  • Shortest first: sorts by line length. Useful for spotting the shortest keywords or the tightest headline options.
  • Longest first: finds the longest entries quickly, for example names that might not fit on a certificate or ID card.
  • Reverse current order: flips the list exactly as it is, without sorting. Turn 1 to 10 into 10 to 1 for a countdown, or show the newest entries of a log first.
  • Shuffle: random order, fair to every line. More on that below.

A quick length example. This list:

Mumbai
Delhi
Thiruvananthapuram
Pune

with "shortest first" becomes:

Pune
Delhi
Mumbai
Thiruvananthapuram

Pune has 4 letters, Delhi 5, Mumbai 6 and Thiruvananthapuram 18.

Why this shuffle list is actually fair

A lot of quick code online shuffles a list by "sorting it randomly", asking the computer to flip a coin each time it compares two items. It looks random, but it isn't fair. Depending on the browser, some items tend to stay near where they started, so the first name in your list may win more often than it should.

This page uses the Fisher–Yates shuffle instead. In plain words: it picks a random line from the whole list for the last spot, then a random line from what's left for the spot before it, and so on until every spot is filled. Each line gets an equal chance at every position, and every possible order is equally likely.

That makes it fine for:

  • deciding the speaking order for class presentations,
  • a casual draw or raffle order among friends or a small club,
  • shuffling quiz questions or flashcards so you don't memorise the order,
  • picking who goes first in a game.

For anything with money or legal rules attached (an official lucky draw, say), use a method your organisers can audit and repeat, and record how the draw was done. A browser shuffle can't be replayed later to prove the result.

The three cleanup options

Real lists are messy, so you can tick these before sorting:

  • Remove empty lines stops blank lines from collecting at the top of an A→Z sort.
  • Remove duplicates keeps one copy of each repeated line.
  • Trim spaces removes spaces at the start and end of lines, so " Amit" doesn't sort differently from "Amit".

If you need finer control over duplicates, like ignoring capital letters or listing only the lines that repeated, use the duplicate line remover first and then sort the result here.

Sort lines from other tools on the site

The sorter pairs well with a few of the other tools:

  • Make a numbered list with the number list generator, then use reverse for a countdown.
  • Generate practice words with the random word generator, then sort them A→Z for a vocabulary sheet.
  • Build a long test list with the line repeater and shuffle it to check how your app handles random order.

Where this text sorter falls short

  • It sorts whole lines only. If your items sit on one line separated by commas, put each on its own line first.
  • No column sorting. For a table where you want to sort by the second column (marks, prices), use a spreadsheet.
  • Language-specific rules. A→Z works well for English and is fine for most everyday lists, but dictionary order for Hindi, or for names with special prefixes, may follow conventions it doesn't know about.
  • No undo history. Reverse flips what is currently in the box, so if you shuffled by accident, paste your original list again.

Everything happens in your browser, so you can sort a list online without signing up or sending your names and notes to a server. Paste, pick a sort, copy. That's the whole job, done the way a careful person would do it by hand, only faster.

Questions people ask

How do I put a list in alphabetical order?

Paste the list with one item per line and choose A→Z. The sort is case-insensitive, so capitalised words don't jump to the top, and numbers inside text are read as whole numbers. Choose Z→A for reverse alphabetical order, then copy the result.

Why does file10 come before file2 in other tools?

Plain sorting compares text character by character, and the character 1 is smaller than 2, so file10 lands before file2. This tool uses natural order, which reads 2 and 10 as numbers, giving file1, file2, file10. It suits roll numbers, chapters and file names.

How do I shuffle a list randomly?

Paste the list and choose shuffle. It uses the Fisher-Yates method, which gives every line an equal chance of landing in any position. That makes it fair for presentation order, flashcards or a casual draw among friends. For official prize draws, use a method your organisers can audit.

Can I sort lines by length?

Yes. Shortest first puts the shortest lines at the top and longest first does the opposite. It is useful for finding the shortest keywords, the tightest headline options, or names that may be too long to fit on a certificate.

How do I reverse the order of a list?

Choose reverse current order. It flips the list exactly as it is without sorting it, so 1 to 10 becomes 10 to 1. Use it for countdowns or to see the newest entries of a log first.

More writing & list tools

Same family, different job.