Line Sorter
Sort, deduplicate and clean lines of text. Multiple sort modes, instant results, 100% in your browser.
How to Use the Line Sorter
- Paste your text — one item per line — into the left panel.
- Choose a sort mode using the chips: A-Z, Z-A, Length, Numeric, Random, or Custom column sort.
- Configure options — enable Remove Duplicates, Trim Whitespace, Ignore Case, or Remove Empty Lines as needed.
- View sorted output in the right panel instantly as you type or change options.
- Copy or download the result using the buttons above the output panel.
Sort Modes Explained
A-Z (Alphabetical)
Sorts lines in ascending alphabetical order using locale-aware comparison. Numbers appear before letters in most locales. Special characters like hyphens and underscores sort before alphanumeric characters. Enable Ignore Case to sort case-insensitively, so "Apple" and "apple" sort together rather than separately (uppercase letters sort before lowercase by default in ASCII order).
Z-A (Reverse Alphabetical)
The reverse of A-Z sort — descends from Z to A. Useful for quickly seeing the last items in a list, reversing a sorted list, or finding the lexicographically largest items. This is not the same as reversing line order, which would require a separate operation.
Length Sort
Sorts lines by character count, shortest first. Empty lines (after trimming) sort to the top. This mode is useful for sorting keywords by length, finding the shortest or longest entries in a list, or preparing data where line length matters (such as CSS rules or SQL columns).
Numeric Sort
Extracts the numeric value from each line and sorts in ascending numeric order. Lines like "10 items", "2.5 kg", and "-3" will sort as numbers, not as strings (string sort would put "10" before "2"). Supports integers, decimals, negative numbers, and lines with mixed text and numbers. Lines with no extractable number are treated as zero.
Random / Shuffle
Randomly shuffles all lines using the Fisher-Yates algorithm, which gives a genuinely uniform distribution. Every permutation is equally likely. Useful for randomizing test data, shuffling a playlist, creating random assignment lists, or picking items in a random order. Each click of the Random chip re-shuffles the list.
Custom Column Sort
Splits each line by a delimiter (comma, tab, pipe, space, or custom character) and sorts by a specific column. For example, to sort a CSV by the third column, choose Comma delimiter and column index 2 (zero-based). Lines that do not have enough columns are treated as having an empty value for the sort column and sort to the top.
Removing Duplicates
The Remove Duplicates option keeps only the first occurrence of each unique line after applying sort order. Combined with Ignore Case, it removes case-insensitive duplicates as well. This is commonly used to deduplicate keyword lists, email addresses, URLs, and other text data that may contain repeated entries from different sources.
Common Use Cases
- Sorting keyword lists for SEO research alphabetically or by length
- Deduplicating email lists, domain lists, or URL lists
- Sorting CSS property lists for consistent formatting
- Alphabetizing bibliography entries or reference lists
- Numeric sorting of version numbers, prices, or scores
- Randomizing survey questions or test item order
- Sorting import statements in code files