Free Text Line Sorter: Alphabetical, Numeric, Length, Reverse & Random
Paste a list and sort lines alphabetically, numerically, by length, in reverse, or randomly — with optional case-insensitivity, deduplication, whitespace trimming, and empty-line filtering. Crypto-strength random shuffle. 100% client-side.
Standard alphabetical order
apple
Apple
Banana
banana
cherry
date
Elderberry
fig
GrapeEight Sort Methods
Alphabetical (A-Z, Z-A), numeric (ascending, descending — by first number in each line), length (shortest to longest, longest to shortest), reverse, and random shuffle.
Dedupe Built In
Optional deduplication runs before the sort. Keep-first preserves original ordering of survivors; keep-last keeps the most recent occurrence of each unique line.
Crypto-Strength Shuffle
Random shuffle uses Fisher-Yates with crypto.getRandomValues — every permutation is equally likely, suitable for fair lotteries and randomized A/B test cohorts.
100% Client-Side
All sorting happens in your browser. Lists may contain emails, customer IDs, or internal data — they never leave the page. Works offline once loaded.
Sort, Dedupe, Shuffle — All Eight Operations in One Pass
Sorting a list of lines is one of those tasks that sounds trivial — until you need numeric ordering (which alphabetic comparison gets wrong), or case-insensitive comparison (which the default JavaScript sort does NOT do), or deduplication BEFORE sorting (so the survivor preserves the original position), or a cryptographically-strong shuffle (so your fair lottery is actually fair). Our Free Text Sorter handles all of these in one place: eight sort methods, three optional cleanup filters (trim, drop empty, dedupe), and a re-shuffle button for randomized output. Pairs naturally with our diff and word-counting tools.
Pair this with our Diff Checker (compare two sorted lists), Word Counter (count lines / words after sorting), Case Converter (normalize before sorting), and the Random Number Generator (same crypto-strength RNG powers both tools).
Six Real-World Uses for a Line Sorter
| Use Case | Why a Sorter Helps |
|---|---|
| Cleaning import lists | Deduplicate email addresses, customer IDs, or contact lists before bulk-importing into a CRM or marketing tool. |
| Alphabetizing references | Sort bibliography entries, glossaries, FAQ items, or sitemap URL lists for consistent presentation. |
| Building random samples | Shuffle a customer list to pick a random test cohort, or randomize a draft list of names for a fair lottery. |
| Sorting IPs / timestamps | Numeric sort orders IP addresses or Unix timestamps correctly; alphabetic sort would produce confusing results. |
| Sanitizing user input | Trim trailing whitespace, drop empty lines, dedupe entries before counting or processing imported records. |
| Prioritizing by length | Sort form-field entries or feedback by length to spot suspicious one-character entries or runaway long ones. |
Sorter Behaviors & Practical Tips
Numeric sort handles negative numbers and decimals correctly
parseFloat-based — "-15.7" sorts before "1.0" sorts before "100".
Mixed numeric/non-numeric lines: numbers come first
Lines without a leading number fall to the bottom and sort among themselves alphabetically.
Dedupe with "keep first" preserves original ordering of survivors
When you also sort, dedupe happens before the sort — the surviving lines then get reordered.
Trim whitespace before dedupe
Otherwise "apple" and "apple " count as different entries. Toggle both options together for cleanest results.
Random shuffle uses crypto-strength RNG
Same Fisher-Yates algorithm as our Password and Random Number generators — each permutation equally likely.
Four Sort Gotchas Worth Knowing
1. Alphabetical Sort of Numbers Is Wrong
"1, 10, 100, 2, 20, 3" — alphabetical sort places "10" and "100" before "2" because the character "1" precedes "2". Use numeric sort for any list with leading numbers.
2. Case-Sensitive Sort Splits Cases
Default JavaScript sort places ALL uppercase before ALL lowercase: "Apple, Banana, apple, banana". Toggle case-insensitive to merge them: "apple, Apple, banana, Banana".
3. IP Addresses Sort Awkwardly
Numeric sort uses ONLY the first octet. For true IP-order ranking, zero-pad each octet (192.168.001.010) and use alphabetical sort instead.
4. Trailing Whitespace Causes Phantom Duplicates
"[email protected]" and "[email protected] " sort as different lines AND survive dedup unless you trim. The defaults trim — turn that off only when whitespace matters.