Sort Text Lines Online
Sort a list of lines alphabetically, numerically, by length, or shuffle them randomly — right in your browser. Your text stays local.
Sort Text Lines runs entirely in your browser. The list you paste is sorted on your device and is never uploaded to ArrayKit or any server.
Open the Remove Duplicate Lines tool
About Sort Text Lines
Sort Text Lines takes a pasted list — one item per line — and reorders it however you need. Sort alphabetically A→Z or Z→A, sort numerically so item2 lands before item10, order by line length, or shuffle the lines into a random order. Toggles let you compare case-insensitively, trim surrounding whitespace, drop blank lines, and remove duplicates before sorting, so a messy paste becomes a clean, ordered list. The output updates live with a running line count you can copy or download as a text file. It is handy for tidying config values, alphabetizing names or imports, ordering CSV columns, or randomizing a draw. Everything runs on your device — the list you paste never leaves your browser.
Features
- Sort alphabetically A→Z or Z→A with locale-aware collation
- Numeric (natural) sort so item2 comes before item10
- Sort by line length, shortest to longest
- Shuffle lines into a random order with a one-click reshuffle
- Case-insensitive toggle treats Apple and apple as equal
- Trim whitespace, remove blank lines, and drop duplicates before sorting
- Live output with a line count, plus copy and .txt download
- Runs entirely in your browser with nothing uploaded
How to use the Sort Text Lines
- Paste or type your list, one item per line
- Pick a mode: A→Z, Z→A, Numeric, Length, or Shuffle
- Toggle case-insensitive, trim, remove blanks, or remove duplicates as needed
- Copy the ordered result or download it as a text file
Example
Input
banana
Apple
cherry
apple
cherry
Output
Apple
banana
cherry
A→Z with case-insensitive and remove-duplicates on: the second apple and cherry collapse to the first.
Common errors & troubleshooting
- Numbers sort in the wrong order — item10 appears before item2. — Switch from A→Z to the Numeric mode. Alphabetical sorting compares character by character, so pick Numeric for natural number order.
- Duplicate lines are still in the sorted output. — Turn on 'Remove duplicates'. It keeps the first occurrence of each line; combine it with 'Case-insensitive' to also collapse Apple and apple.
- Leading or trailing spaces are throwing off the alphabetical order. — Enable 'Trim each line' so surrounding whitespace is stripped before sorting and in the copied output.
- Shuffle keeps producing the same order after re-running. — Click Reshuffle to draw a new random arrangement. Each press reshuffles the current list into a fresh order.
Frequently asked questions
- How do I sort a list of lines alphabetically?
- Paste your list one item per line, choose A→Z for ascending or Z→A for descending, and the sorted result appears instantly. Turn on 'Case-insensitive' if you want Apple and apple treated as the same.
- How is Numeric sort different from alphabetical sort?
- Alphabetical sort compares text character by character, so item10 comes before item2. Numeric (natural) sort reads the digits as numbers, so item2, item10, item20 stay in true numeric order.
- Does the shuffle produce a truly random order?
- Shuffle uses a Fisher–Yates pass to rearrange the lines into a random order. Each click of Reshuffle draws a new arrangement, so you can keep reshuffling until you are happy with the result.
- Can I remove duplicates and blank lines while sorting?
- Yes. Toggle 'Remove duplicates' to keep only the first copy of each line and 'Remove blank lines' to drop empties. Both apply before the chosen sort so the output is clean and ordered.
- What does sorting by length do to lines of equal length?
- Length mode orders lines from shortest to longest. When two lines are the same length it breaks the tie alphabetically, so equal-length items still come out in a predictable order.
- Is the list I paste to sort uploaded anywhere?
- No. Sort Text Lines runs entirely in your browser, so the list you paste is sorted on your device and never sent to ArrayKit or any server.
Related tools
- Remove Duplicate Lines — Remove duplicate lines from a list, with case, trim, keep-first-or-last and sort options.
- Text Diff — Compare two texts line-by-line and see additions and removals.
- Case Converter — Convert text between camelCase, snake_case, kebab-case, PascalCase and more.
- Word & Character Counter — Count words, characters, sentences, lines, bytes and approximate tokens, live.
- Find and Replace Text — Find and replace text with plain or regex search, case sensitivity, whole-word and global options.
- Slug Generator — Turn a title into a clean, URL-safe slug, with batch mode.
All ArrayKit tools