Sort Lines Tool
The Sort Lines Tool lets you sort text lines alphabetically, numerically, by length, or randomly. It also supports removing duplicates, trimming whitespace, and case-insensitive sorting. Perfect for organizing lists, cleaning up data, and preparing text for further processing.
Choose from multiple sort modes: A to Z, Z to A, numeric order, line length, or random shuffle. Enable toggles for case-insensitive comparison, duplicate removal, and whitespace trimming to get exactly the output you need.
How it works
Alphabetical sorting uses locale-aware string comparison. Numeric sorting parses leading numbers from each line. Length sorting compares character counts. Random mode uses the Fisher-Yates shuffle algorithm.
Use cases
- Sorting word lists or glossaries alphabetically
- Organizing CSV data or log entries by value
- Removing duplicate lines from large text files
- Sorting numeric data like scores or measurements
- Randomizing lists for quizzes, drawings, or assignments
Frequently asked questions
How do I sort a list alphabetically online?
Paste your list into the tool with one item per line, choose the A to Z mode, and the lines are reordered instantly using locale-aware string comparison. Pick Z to A if you need reverse alphabetical order, and enable the case-insensitive toggle so uppercase and lowercase versions of the same word sort together.
How do I remove duplicate lines from a text file?
Enable the remove-duplicates toggle and every repeated line is kept only once in the output. Combine it with the trim-whitespace option so lines that differ only by leading or trailing spaces are treated as the same line, and with case-insensitive mode if "Apple" and "apple" should count as duplicates.
Why does alphabetical sorting put 10 before 2?
Alphabetical sorting compares text character by character, so "10" comes before "2" because the character "1" precedes "2". Switch to numeric mode instead: it parses the leading number on each line and orders lines by their actual numeric value, which is what you want for scores, prices, or measurements.
How can I randomly shuffle a list of names?
Choose the random mode, which shuffles the lines using the Fisher-Yates algorithm — a method that gives every possible ordering an equal chance. Run it again to get a fresh shuffle, which is handy for drawings, quiz question order, or assigning tasks fairly.
What does sorting by line length do?
Length mode compares the character count of each line and orders lines from shortest to longest. It is useful for spotting outliers in data, organizing word lists by size, or arranging text for visual layouts where line length matters.