Sort Text Lines

Sort lines alphabetically, reverse, by length, or randomly.

Paste text lines above to sort them

Frequently Asked Questions

What sort modes are available?

The tool offers multiple sort modes: alphabetical (A-Z), reverse alphabetical (Z-A), by line length (shortest or longest first), numerical (for lines starting with numbers), and random shuffle. Each mode processes your entire text instantly and displays the sorted result.

How does numerical sorting differ from alphabetical?

Alphabetical sorting treats characters left-to-right, so "9" comes after "10" because "9" > "1". Numerical sorting extracts the leading number from each line and sorts by its value, so 9 correctly comes before 10. Lines without leading numbers are grouped at the end.

Can I sort case-insensitively?

Yes — toggle the case-insensitive option to treat uppercase and lowercase letters as equal during comparison. "apple" and "Apple" will be grouped together. The original casing of each line is preserved in the output; only the sort comparison ignores case.

Does the random shuffle produce truly random results?

The shuffle uses the Fisher-Yates algorithm with Math.random(), which produces a uniform distribution suitable for most purposes. Each click generates a new random order. It is not cryptographically secure, but for shuffling text lines it provides excellent randomness.

Can I remove duplicates while sorting?

Yes — enable the "remove duplicates" option to automatically eliminate repeated lines during the sort operation. This combines sorting and deduplication into a single step, giving you a clean, ordered, unique list.