
Line Sorter
Sort, deduplicate and clean lines of text. Multiple sort modes, instant results, 100% in your browser.
Last reviewed: June 2026New to this tool? Click here for instructions
How to Use the Line Sorter
Paste one item per line, choose a sort mode, and the output panel updates immediately. Options let you trim whitespace, remove empty lines, ignore case, and deduplicate after sorting.
- Choose A-Z, Z-A, Length, Numeric, Random, or Custom.
- For Custom mode, choose a delimiter and a zero-based column index.
- Use Remove Duplicates when you want only the first occurrence of each unique line.
- Copy or download the sorted text from the output panel.
When to Use the Tool in Real Workflows
Use it for SEO keyword lists, CSV-ish exports, URL lists, bibliography cleanup, CSS property lists, QA test data, allowlists, deny lists, and any small-to-medium text list where quick browser-only sorting is faster than opening a spreadsheet.
How It Works
The sorter splits the input on line breaks, applies the selected cleanup options, then sorts a local JavaScript array. Alphabetical and custom-column modes use string comparison, Length mode compares line lengths, Numeric mode extracts the first numeric value it can parse from each line, and Random mode shuffles with Math.random(). Your text is not sent to a server.
For implementation background, see MDN on Array.prototype.sort() and String.prototype.localeCompare().
Tips, Edge Cases, or Limitations
- Numeric mode treats lines with no number as zero.
- Custom column indexes are zero-based: column 0 is the first field.
- Random mode is for casual shuffling, not cryptographic randomness or drawings.
- Very large pasted files can be limited by browser memory and textarea performance.
Frequently Asked Questions
Quick reference
| Control | What it does | Useful for |
|---|---|---|
| A-Z / Z-A | Alphabetical ascending or descending sort. | Keywords, names, URLs, headings. |
| Length | Shortest line to longest line. | Finding outliers or overly long labels. |
| Numeric | Sorts by the first number parsed from each line. | Ranked lists, issue IDs, version-like notes. |
| Custom | Sorts by a selected delimiter column. | CSV snippets, pipe-delimited logs, tabular text. |
| Cleanup options | Trim, remove empty lines, deduplicate, or ignore case. | Preparing lists before import or comparison. |
Example walk-through
Sort and deduplicate a keyword list
Step 1. Paste these lines into the input panel:
banana
apple
cherry
apple
date
Step 2. Keep A-Z selected and enable Remove Duplicates.
Step 3. The output panel updates as soon as the option changes.
apple
banana
cherry
date
Step 4. Copy the output or download it as sorted-lines.txt.