String Reverse/Sort

Reverse text, sort lines alphabetically or numerically, or shuffle randomly.

Examples

InputResult
cherry\napple\nbanana (Sort A-Z)apple\nbanana\ncherry
10\n2\n30\n1 (Sort 0-9)1\n2\n10\n30
hello (Reverse text)olleh
first\nsecond\nthird (Reverse lines)third\nsecond\nfirst

About this tool

This tool gives you several ways to reorder text. You can sort lines alphabetically (A-Z or Z-A), numerically (ascending or descending), shuffle them randomly, reverse the entire string character by character, or reverse the order of lines while keeping each line intact.

Numeric sorting is particularly handy when you have a list of numbers or lines that start with numbers, since a plain alphabetical sort would put "10" before "2". The shuffle option uses the Fisher-Yates algorithm for a fair random distribution, and you can re-shuffle as many times as you want.

Frequently asked questions

What is the difference between "Reverse text" and "Reverse lines"?

"Reverse text" flips the entire string character by character, so "abc" becomes "cba". "Reverse lines" keeps each line intact but reverses their order, putting the last line first.

How does numeric sort differ from alphabetical sort?

Alphabetical sort compares strings character by character, so "10" comes before "2". Numeric sort parses lines as numbers first, so 2 comes before 10 as you would expect.

Does the shuffle produce a truly random result?

It uses the Fisher-Yates shuffle algorithm with Math.random(), which gives a good pseudo-random distribution. Each time you click Shuffle, the lines are reordered randomly.

EchoBeaver — Free browser tools