Sort lines
Sort lines is a text tool that reorders a list of lines using one of several modes. It supports alphabetical (ascending or descending), by length, and random shuffle, plus options to deduplicate, trim whitespace, and remove empty lines. The tool runs in your browser.
Input
Sorted output
SORT OPTIONS
Dedicated pages
Mode-specific and use-case sort tools.
Sort lines alphabetically
Sort text lines alphabetically (A–Z or Z–A) instantly. Paste your list, sort it, and copy the result. Free, runs in your browser.
Sort list online
Sort any list online: alphabetically, by length, or shuffle randomly. Remove duplicates and trim whitespace. Free, runs in your browser.
Remove duplicate lines
Remove duplicate lines from any text list. Optionally sort the result alphabetically. Free, runs entirely in your browser.
How to sort lines
- Paste your list into the input area, one item per line.
- Choose a sort mode: A to Z, Z to A, shortest first, longest first, or shuffle.
- Toggle options like Remove duplicates or Trim whitespace as needed.
- The sorted output appears instantly. Copy it from the output area.
Common uses
- Sorting alphabetical lists such as names, keywords, or file names in one click
- Removing duplicate entries from a list before importing into a spreadsheet or database
- Working alongside find and replace and word counter for complete text workflows
Technical specification
- Algorithm or formula: Alphabetic and length-based sort use
Array.prototype.sortwith a locale-aware comparator (Intl.Collator). Shuffle mode uses the Fisher-Yates algorithm withMath.random(). - Browser API or library: Native
Array.prototype.sortandIntl.Collator; no external library. - Input limits: No hard cap; tested with lists of 100,000 lines on modern hardware.
- Output: Sorted text in the output pane, copyable to clipboard, with a count summary of original and resulting line counts.
- Known limitations: Alphabetical comparison is case-insensitive by default and follows the browser's locale.
Math.random()is not cryptographically secure but is sufficient for visual shuffling.
Frequently asked questions
- What sort modes are available?
- Five modes: A to Z (alphabetical ascending), Z to A (alphabetical descending), Shortest first (by character count), Longest first (by character count), and Shuffle (random order using Fisher-Yates).
- How does duplicate removal work?
- Duplicate removal keeps the first occurrence of each unique line and discards the rest. Comparison is case-insensitive and respects any whitespace trimming you have enabled.
- Can I shuffle my list randomly?
- Yes. The Shuffle mode uses the Fisher-Yates algorithm with Math.random() to produce a randomly ordered list. Each shuffle produces a different order.
- Is my text sent to a server?
- All text processing runs locally in your browser. No data is sent to our servers.
Reviewed and tested May 26, 2026.