Sort Lines
Paste any list of lines and get them sorted alphabetically, numerically, by length, or randomly shuffled. Reverse order, case sensitivity, and natural-sort (the one that puts file2 before file10) are all toggleable. Works on lists pasted from spreadsheets, log files, terminal output, or any newline-delimited text.
Why Sorting Lines Is a Daily Task
Half the small text-wrangling jobs that come up in a workday are some flavour of sort. A list of email addresses needs to go in alphabetical order for a mail merge. A column copy-pasted from a CSV needs to be sorted before being de-duplicated (see the remove duplicate lines tool for the next step). A list of filenames needs natural order so image10.jpg doesn't come between image1.jpg and image2.jpg. Each of these takes about five seconds with the right tool and five minutes without one.
The classic Unix sort command handles all of these and more, but pulling text out of a browser, into a terminal, through sort, and back into the browser is enough friction that most people give up and live with unsorted lists. A web-based sorter removes the friction.
How It Works
The tool splits the input on newline characters, builds an array of lines, and applies the chosen comparator. Alphabetical uses the browser's Intl.Collator which respects locale-aware ordering — useful when your data contains accented characters or non-Latin scripts. Numerical sort parses each line as a float and falls back to string sort for non-numeric lines. Natural sort uses a tokenized comparison that treats digit runs as numbers, so item-2 comes before item-10. Length sort orders by character count.
Random shuffle uses the Fisher-Yates algorithm seeded with crypto.getRandomValues(), which is the same source the UUID generator uses. The result is statistically uniform, which matters if you're using the sort to randomize survey question order, draw a sample, or pick a winner from a list of entries.
Common Use Cases
Alphabetizing a list of names before importing into a CRM. Sorting log entries by timestamp prefix to spot the chronological gap. Putting CSS class names in alphabetical order so the diff shows actual changes, not rearrangements. Generating a random play order for a music queue. Ordering URLs before passing them to a sitemap generator. Putting a glossary in order before publishing.
How We Compare
VS Code, Sublime Text, and most modern editors have a sort-lines command built in (in VS Code it's the Command Palette's Sort Lines Ascending). For one-offs outside an editor — or for the natural-sort and length-sort options that most editors don't ship with — a web tool is faster. Spreadsheet apps will sort a column, but require getting the data into the spreadsheet first. This tool handles plain text directly, runs entirely in the browser, and works on lists from a few lines to tens of thousands.
Frequently Asked Questions
Related Tools
Related ToolRemove Duplicate Lines →📖 Learn More
Related Guide How to Sort Lines of Text →Built by Derek Giordano · Part of Ultimate Design Tools