Line Sorter
Sort lines alphabetically, by length, naturally, or randomly. Remove duplicates and trim whitespace. Supports ascending, descending, and custom sort modes.
How to Use
- 1
Paste your lines
Enter one item per line in the input area — a list of names, URLs, log entries, or any text.
- 2
Choose sort mode and options
Select a sort mode from the dropdown. Optionally check 'Remove duplicates' and 'Trim lines'.
- 3
Click Sort
The sorted result appears in the output area. Click Copy to copy it to your clipboard.
What is Line Sorter?
A line sorter takes a block of text, splits it into individual lines, and reorders them according to the selected sorting method. This online tool is useful for organizing lists, sorting CSV data, deduplicating log entries, alphabetizing imports, and cleaning up any line-based text. It is the browser equivalent of `sort` on the command line, but with more sort modes and a visual workflow.
This tool offers 9 sorting modes: alphabetical (ascending/descending, case-sensitive/insensitive), by line length, natural sort (handles numbers intelligently — file1, file2, file10 instead of file1, file10, file2), reverse order, and random shuffle. Optional features include removing duplicate lines and trimming leading/trailing whitespace from each line so duplicates aren't missed because of stray spaces.
To deduplicate without sorting (preserving original order), use the [Duplicate Line Remover](/tools/duplicate-line-remover/). To clean whitespace before sorting, run [Whitespace Cleaner](/tools/whitespace-cleaner/) first. To count lines after sorting, see [Line Counter](/tools/line-counter/).
FAQ
What is natural sort?
How does Remove duplicates work?
Can I sort CSV data?
How is this different from sort on the command line?
Related Articles
Related Tools
Duplicate Line Remover
Remove duplicate lines from text while preserving order. Paste a list, get unique lines instantly.
Line Counter
Count lines, words, characters, sentences, and paragraphs in any text. Real-time text statistics with reading time estimate.
Text Reverser
Reverse any text character by character. Handles Unicode, emoji, and multi-byte characters correctly.
Diff Checker — Text Compare
Compare two texts side-by-side and see the differences highlighted. Find added, removed, and unchanged lines instantly.
Add Prefix & Suffix to Lines
Add a prefix, suffix, or both to every line of text. Wrap lines in quotes, HTML tags, or any custom string.
Add Line Numbers
Add line numbers to any text. Formats with aligned padding and a separator — ready for code reviews, documentation, or sharing.