← All tools/Utilities/Text/Text Line Sorter

Text Line Sorter

Sort the lines of any pasted list — alphabetically, numerically, by length, or shuffled.

Sorted lines

—

Bars show each line’s length, longest line first

How it works

Each line is one item and is reordered with a locale-aware string comparison.
A–Z / Z–A: alphabetical order, case-insensitive when the toggle is on.
Numeric: lines are compared by their leading number.
By length: shortest line first, ties broken alphabetically.
Reverse: the order is flipped end to end.
Shuffle: lines are reordered at random with the Fisher–Yates shuffle.

Worked example: the lines “banana”, “Apple” and “cherry” sorted A–Z case-insensitively become “Apple”, “banana”, “cherry”. Sorted by length they come out the same way — Apple has 5 letters, banana and cherry have 6 each.

Frequently asked questions

What does Ignore case do?

With it on, “Apple” and “apple” sort as the same word, so capital letters do not jump ahead of lower-case ones. Turn it off and sorting follows the usual code order, where capitals come first.

How does Numeric sort handle mixed lines?

Lines that start with a number sort by that number — 2 comes before 10. Lines with no number fall back to alphabetical order.

Is Shuffle really random?

Yes. Each click reorders the lines with the Fisher–Yates shuffle and JavaScript’s Math.random, so the order is different every time you press it.

Will it keep my blank lines?

Only if you switch off Remove empty lines. With it on, blank lines are dropped before sorting, so the result is a tight list.

More tools

Tell us what you think

Loving this tool, or stuck on something? Tell us — it takes a minute.

We’ll only use your name and email to reply if needed. The tool and page are filled in for you.