Sort Lines
Sort lines alphabetically, by natural/version order, numerically, by length, reversed, or shuffled — with by-field keys, dedupe, and trim. Live as you type.
About this ToolHow it works, benefits & use casesTap to collapse
Sort Lines reorders pasted text by line using six modes, all live as you type. Alphabetical does a standard A→Z sort; natural order treats embedded numbers numerically so item2 comes before item10 and v1.2.9 before v1.2.10; numeric sorts by the first number found in each line; length sorts by how long each line is; reverse flips the current order; and random shuffles the lines — with an optional seed for a reproducible shuffle. Ascending or descending applies to the ordered modes. You can sort by a specific field instead of the whole line (set a field number and a delimiter, defaulting to whitespace), compare case-insensitively or case-sensitively, trim lines before comparing, ignore blank lines, and remove duplicates as part of the sort. Live stat cards show lines in, lines out, and how many were removed. The result downloads as a .txt file and the input, mode, and order are captured in a shareable URL. Everything runs in your browser.
How to Use
- 1In "Sort options", pick a "Mode" (alphabetical, natural, numeric, length, reverse, or random) and an order (ascending or descending).
- 2Optionally enable case sensitivity, trim-before-compare, ignore blank lines, or remove duplicates.
- 3To sort by a column, set "Sort by field" to a number and enter a field delimiter (blank uses whitespace); for random mode, set a shuffle seed if you want it reproducible.
- 4Paste your lines into the input box, or click "Load example" — the sorted output appears live below.
- 5Click "Sort", then copy or download the result, or copy the page URL to share the exact setup.
Key Benefits
- Six modes: alphabetical, natural/version, numeric, length, reverse, and random shuffle
- Natural order so item2 < item10 and v1.2.9 < v1.2.10
- Sort by a specific field with a custom or whitespace delimiter
- Case-insensitive or case-sensitive comparison, with optional trim
- Ignore blank lines and remove duplicates during the sort
- Seeded random shuffle for reproducible results
- Live in/out/removed stats, .txt download, and a shareable URL
Common Use Cases
- Alphabetizing a list of names, imports, or dependencies
- Version-sorting tags or filenames so v1.2.10 lands after v1.2.9
- Sorting CSV-like rows by a specific column using a delimiter
- Numerically ordering lines that begin with an ID or price
- Randomly shuffling a list reproducibly for sampling or assignment
Sort options
For Random shuffle
0 characters · live
Enter text above to see the sorted result.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- Remove Duplicate LinesRemove duplicate lines from text
- Whitespace RemoverRemove extra whitespace from text
- Word CounterCount words, characters, sentences, and reading time
- Text StatisticsGet comprehensive statistics about your text
- String ReverserReverse any text string
- Text to SlugConvert text to URL-friendly slugs
Alphabetical sorting compares text character by character, so "item10" sorts before "item2" because 1 comes before 2. Natural order splits each line into number and non-number runs and compares the numeric runs as numbers, so "item2" correctly comes before "item10" and version strings like v1.2.9 sort before v1.2.10.
Set "Sort by field" to the 1-based position of the column you want to sort on, and provide a field delimiter — leave it blank to split on runs of whitespace, or enter a character like a comma for CSV-style data. The sort key is taken from that field while the whole line is kept in the output.

