Free Sort Lines Tool - Sort Text Alphabetically Online (2026)
Paste any list and sort lines alphabetically, numerically, or shuffle randomly - in one click. Toggle case-sensitivity and whitespace trimming. Free, private, and runs entirely in your browser.
A→Z · Z→A · Numeric · Shuffle - case & trim controls - all free, all instant.
Works with any plain-text list: CSV data, log files, word lists, to-do items, and more.
Last updated: June 5 2026
Reviewed by the QuickTooly Team
Sort Lines Guide
Why Sort Lines of Text Online?
Sort lines means reordering a plain-text list so every line appears in a chosen sequence - alphabetical, reverse alphabetical, numeric, or random. This free browser tool does it instantly, with no server uploads and no account required.
Sorting a list of text lines is one of the most common data-cleaning tasks - whether you're organising a word list, alphabetising entries before importing them into a spreadsheet, deduplicating log output, or randomising a set of names for a raffle. This tool handles all of those cases instantly, without opening a terminal or writing a formula.
- Developers: Sort import statements alphabetically, organise config keys, or shuffle test-fixture data for randomised testing.
- Data workers & analysts: Alphabetise CSV exports, sort keyword research lists before import, or order product names for a clean catalogue.
- Teachers & quiz makers: Shuffle question sets or answer options so no two students see items in the same order.
- Writers & researchers: Alphabetise bibliography entries, sort tags, or order a glossary before publishing.
- Alphabetical (A→Z / Z→A): Standard lexicographic sort using the browser's built-in
localeCompare, which correctly handles accented characters and locale-specific ordering rules. - Numeric sort: Parses each line as a number and sorts by value, so
10comes after9(not before, as a text sort would produce). - Shuffle: Randomises line order using a Fisher-Yates shuffle - every permutation is equally likely. Useful for randomising question sets, test data, or name draws.
- Case & trim controls: Ignore case so "Apple" and "apple" sort together; trim leading/trailing whitespace so accidental spaces don't affect ordering.
How to Sort Lines - 3 Steps
- Paste your lines into the textarea above - one item per line.
- Choose sort order and options - A→Z for alphabetical, Numeric for number lists, Shuffle for random order; toggle case and trim as needed.
- Click Sort, then copy - use the individual Copy buttons or "Copy All" to grab the entire sorted list at once.
Understanding the Sort Options
Alphabetical Sort (A→Z / Z→A)
Uses the browser's built-in localeCompare for locale-aware ordering, so accented characters (é, ñ, ü) sort correctly for their language. A→Z is the most common choice for word lists, names, tags, and glossaries. Z→A reverses the result - useful for reverse-ordered exports or showing the most recent timestamps first.
Numeric Sort
Parses each line as a floating-point number and sorts by value ascending. This means 9 correctly comes before 10, unlike alphabetical mode where "1" < "9" makes 10 sort first. Use Numeric mode for scores, prices, ranked lists, or any data where line order should follow mathematical value.
Shuffle (Random Order)
Applies a Fisher-Yates shuffle - a proven algorithm that produces a uniformly random permutation where every possible ordering is equally likely. Click Sort again at any time to get a completely new shuffle. Ideal for randomising quiz questions, raffle entries, test data sets, or any list where unpredictable order matters.
Case & Trim Controls
Ignore case makes "Apple", "apple", and "APPLE" sort as if they were identical - they appear adjacent in the output. Exact case preserves casing differences, so uppercase letters sort before lowercase in most locales. Trim whitespace strips leading and trailing spaces before sorting, which prevents lines like " apple" and "apple" sorting differently due to invisible padding - a common issue when pasting from spreadsheets or PDFs.
| Mode | How it works | Best for |
|---|---|---|
| A→Z | Locale-aware ascending alphabetical order; handles accents correctly | Word lists, names, tags, glossaries |
| Z→A | Reverse alphabetical - same rules, descending | Reverse-ordered exports, timestamps |
| Numeric | Parses each line as a float and sorts by value (ascending) | Scores, prices, ranked lists, version numbers |
| Shuffle | Fisher-Yates random permutation | Randomising quizzes, draws, test data |
Pro Tips for Better Sorting
- Pasting from a spreadsheet: Enable Trim - cells copied from Excel or Google Sheets often carry invisible leading/trailing spaces that cause lines to sort out of place.
- Deduplicate first, then sort: Run your list through the Remove Duplicate Lines tool first, then sort - deduplication preserves insertion order, so you get a clean, unique, sorted result.
- Version numbers: Use Numeric sort for simple version integers. For semantic versions like
v1.10.2, note that only the leading number is parsed - alphabetical sort often works better for full semver strings. - Large lists: There is no line limit - the tool runs entirely in your browser and can handle thousands of lines without slowing down.
Frequently Asked Questions
How is alphabetical sort different from numeric sort?
Alphabetical sort compares characters left to right, so 10 sorts before 9 (because "1" < "9"). Numeric sort converts each line to a number first, so 9 correctly comes before 10. Use Numeric mode whenever your lines contain numbers you want ordered by value.
What does "Ignore case" do?
With Ignore case on, "Apple", "apple", and "APPLE" are treated as identical for sorting purposes and will appear adjacent in the output. With Exact case, uppercase letters sort before lowercase in most locales, so "Apple" would appear before "banana".
What does "Trim whitespace" do?
When Trim is On, leading and trailing spaces are stripped from each line before sorting. This prevents lines like " apple" and "apple" from sorting differently due to invisible whitespace - a common issue when pasting from spreadsheets or PDFs.
Can I sort lines in reverse alphabetical order?
Yes - select the Z→A option. It uses the same locale-aware comparison as A→Z but inverts the result, so the last item alphabetically appears first.
How does the Shuffle mode work?
The shuffle uses the Fisher-Yates algorithm, which produces a uniformly random permutation - every ordering of your lines is equally likely. Click Sort again to get a different shuffle.
Is my text stored or sent anywhere?
No. All sorting happens entirely in your browser using JavaScript. Your lines are never sent to any server, stored in a database, or shared with any third party.
How does Sort Lines compare to the Excel SORT function?
Excel's SORT function operates on spreadsheet columns and requires you to open a file and write a formula. This tool works on any raw text you paste - one item per line - directly in your browser with no file upload, no formula, and no Excel licence needed. It also supports case-insensitive sorting and whitespace trimming that Excel doesn't offer natively for plain-text lists.
Can I sort more than 1 000 lines?
Yes - there is no line limit. All sorting runs in your browser's JavaScript engine, which can comfortably handle tens of thousands of lines in milliseconds. For extremely large files (hundreds of thousands of lines), a command-line tool like sort may be faster, but for everyday use this tool has no practical ceiling.
Sort Lines Online vs Excel, Linux & Python
Not sure which method fits your workflow? Here's how this browser-based sort tool compares to the most common alternatives.
- Excel SORT / AutoSort - designed for spreadsheet columns and rows, not raw line lists. Requires opening a file and applying a formula or using the ribbon. This tool needs no file, no formula, and no software licence - paste your text and click Sort.
- Linux / macOS
sortcommand - powerful and scriptable but requires a terminal and shell knowledge. Useful for automated pipelines; for a quick one-off sort of a keyword list or name roster, a browser tool is considerably faster. - Python
sorted()- precise and automatable, ideal for large files or repeated workflows. For a quick interactive sort with case and trim toggles, you'd need to write and run a script; this tool does it in two clicks. - Google Sheets - column-based and best for structured row data. Sorting a raw plain-text list (one item per line) requires first pasting into a column, sorting, then copying back out - several extra steps compared to pasting directly here.
Related Text Tools
More free browser-based text utilities from QuickTooly:
- Remove Duplicate Lines - deduplicate any text list with case-insensitive and trim options; great to run before sorting.
- Word Counter - count words, characters, sentences, and estimate reading time for any text.
- Text Cleaner - strip HTML tags, fix spacing, remove special characters, and normalise any text block.
- Case Converter - convert text to UPPER CASE, lower case, Title Case, or sentence case instantly.
- Text Repeater - repeat any text N times with a custom separator; handy for test data generation.
Browse the full Text Tools suite for all free utilities.