Sort Lines
Free online line sorter. Sort lines alphabetically, reverse, numerically, by length, or shuffle randomly. Remove duplicates after sorting.
Why Use Our Sort Tool?
Our sort tool provides multiple ways to organize your lines of text. From simple alphabetical sorting to numerical ordering, length-based sorting, and random shuffling, you can quickly reorganize any list. The duplicate removal option adds an extra layer of data cleaning, making this tool essential for working with lists, data sets, and text files.
Key Features
- Alphabetical sort (A→Z) and reverse sort (Z→A)
- Numerical sort for proper number ordering
- Sort by line length for size-based organization
- Random shuffle for randomized ordering
- Remove duplicates option after sorting
How to Use This Tool
- Paste or type your lines of text (one item per line)
- Select the sort mode from the dropdown
- Toggle 'Remove Duplicates' if needed
- Copy the sorted result for your use
Technical Details
Alphabetical sorting uses localeCompare() for proper international character ordering. Numerical sort parses each line as a float and sorts by numeric value, placing non-numeric lines at the end. Length sort compares string lengths. Random shuffle uses the Fisher-Yates algorithm for unbiased randomization. Duplicate removal uses a Set for O(n) deduplication after sorting.
Frequently Asked Questions
How does numerical sort handle non-numeric lines?
Lines that can't be parsed as numbers are sorted to the end of the list, after all numeric lines in ascending order.
Is the random shuffle truly random?
The shuffle uses the Fisher-Yates algorithm, which is mathematically proven to produce an unbiased, uniformly random permutation.
Does 'Remove Duplicates' work with all sort modes?
Yes, duplicate removal works with all sort modes. It removes exact duplicate lines after sorting is applied, keeping one instance of each unique line.
Related tools
Text Compare
Compare two texts side by side and find differences with highlighted word-by-word diff
Word Counter
Count words, characters, sentences, paragraphs and estimate reading time instantly
Case Converter
Convert text to UPPER CASE, lower case, Title Case, Sentence case, camelCase, PascalCase, snake_case, and kebab-case
Text Repeater
Repeat text multiple times with customizable separator options
Remove Duplicates
Remove duplicate lines from text with options for case sensitivity, trimming, and order preservation
Find & Replace
Find and replace text with support for case sensitivity, whole word matching, and regular expressions