Free Text Sorter

Sort any list of lines alphabetically, numerically, by length, or shuffle them randomly. Remove duplicates and blank lines along the way — all in real time, right in your browser.

A → Z
Alphabetical
Z → A
Reverse Alpha
1 → 9
Numeric
9 → 1
Reverse Numeric
Shortest First
By Length
Longest First
By Length
Shuffle
Random Order
Flip Order
Reverse Lines
Lines: 0
Words: 0
Duplicates found: 0
Works 100% in your browser
Text never leaves your device
No sign-up needed

What This Text Sorter Does

Paste any list into the editor with one item per line, then click a sort button to reorder every line instantly. The tool supports alphabetical sorting in both directions, true numeric sorting that reads magnitude rather than character order, sorting by line length in either direction, a random shuffle, and a simple line-order reversal — all computed entirely inside your browser using JavaScript, so nothing you paste is ever transmitted to a server.

Before sorting, you can optionally strip blank lines, trim stray leading and trailing whitespace from every line, and remove exact duplicate lines in the same pass. A case-sensitive toggle controls whether "Apple" and "apple" are treated as the same value for ordering purposes, which matters most when sorting code identifiers, tags, or anything where capitalization is meaningful.

This is the natural next step after our Remove Duplicate Lines tool — that tool focuses purely on deduplication, while this one reorders the list as well, with deduplication available as one of the options rather than the primary function.

Tips for Getting Clean Sorted Output

Frequently Asked Questions

How does this text sorter work?

Paste a list into the editor with one item per line, then click any of the eight sort buttons above it. The tool splits your text on line breaks, applies whichever options you've enabled — trimming, blank-line removal, deduplication — and then reorders the resulting array using JavaScript's native comparison-based sort before joining it back into text. All of this happens synchronously inside your browser tab, so nothing you paste is ever transmitted to a server, logged, or stored in any way.

Because there's no upload and no server round-trip, sorting is effectively instant even on lists of several thousand lines, and there's no daily limit or account requirement. You can chain multiple operations back to back — sort alphabetically, then check the result, then switch to numeric — using the Undo button after each step to step backward one operation at a time if a result isn't what you expected.

What is the difference between alphabetical and numeric sorting?

Alphabetical sorting compares lines as plain text, character by character, using standard lexicographic ordering — the same method a dictionary or phone book uses. Numeric sorting instead extracts the leading number from each line with a regular expression and compares lines by that number's actual magnitude. The difference becomes obvious with any list containing double-digit values: sorted alphabetically, "Item 10" lands before "Item 9" because the character "1" precedes "9" in text comparison, while numeric sorting correctly places "Item 9" first because 9 is smaller than 10 as a number.

This distinction matters most for lists of prices ("$9.99" vs "$10.50"), scores, product SKUs, invoice numbers, or any line beginning with digits where true magnitude — not character order — is what a reader expects. If a line doesn't start with a recognizable number, numeric sort falls back to alphabetical ordering for that line and pushes it to the end, so mixed lists don't silently break.

Can I sort a list and remove duplicates at the same time?

Yes. Enabling Remove duplicates in the options row strips exact repeated lines before any sort method is applied, comparing each line against every line seen so far and keeping only the first occurrence. Remove blank lines does the equivalent for empty rows, which commonly appear when pasting multi-column data from a spreadsheet or copying a formatted list out of a PDF. Both options combine with any of the eight sort methods, so a single click can clean and reorder a messy export in one pass.

If deduplication is your primary goal rather than reordering, our dedicated Remove Duplicate Lines tool offers additional modes, including sentence-level deduplication for continuous prose rather than line-based lists, which this sorter does not attempt to handle.

Is sorting case-sensitive by default?

No. By default the sorter lowercases both sides of every comparison before evaluating order, so "Banana", "banana" and "BANANA" are treated as identical values and will end up adjacent to one another rather than scattered across the list based on which letter case happens to sort first in raw character-code order. This matches how people intuitively expect everyday lists — names, grocery items, tags, general vocabulary — to be alphabetized, since capitalization in those cases is usually incidental rather than meaningful.

Enable the Case-sensitive toggle when capitalization should actually influence ordering — sorting programming identifiers, environment variable names, or any dataset where uppercase and lowercase variants of the same word are meant to be treated as distinct values. With it enabled, sorting falls back to raw character-code comparison, where all uppercase letters (A–Z) sort before any lowercase letter (a–z), which is standard behavior in most programming languages' default string comparison.

Can I sort dates, IP addresses, or version numbers correctly?

Numeric sort only reads the very first number on each line, so it works well for a list of plain dollar amounts or scores but won't correctly order dates written as MM/DD/YYYY, IP addresses like 192.168.1.10, or version strings like 2.9.1 — each of those contains several separate numbers, and comparing only the first one produces misleading results. Dates in ISO format (YYYY-MM-DD) are the exception, since the year comes first and sorts correctly both alphabetically and numerically.

For genuinely correct ordering of multi-segment values like IP addresses or semantic version numbers, the most reliable free approach is a short script — for example, splitting each IP octet or version segment on the "." character and comparing them numerically in sequence — since no purely text-based sort can account for the different meaning of each segment. If you're working with a small list, converting dates to ISO format first (YYYY-MM-DD) before pasting them here is the simplest fix, since Alphabetical sort will then produce correct chronological order automatically.

Can I sort text that isn't a simple list, like paragraphs?

The sorter treats every line break as a separate, independent unit to be reordered, so it's built for discrete list items — names, URLs, tags, code identifiers, CSV-style rows, or short entries — rather than continuous prose. If you paste full paragraphs, each line becomes its own sortable "item," and since prose paragraphs are rarely written with one complete, self-contained thought per line, the reordered result is usually not meaningful or usable.

For reordering or analyzing continuous prose rather than list-style data, our Word Counter and Word Frequency Counter are better suited, since they operate at the word and sentence level. If your paragraphs need to be split into individual sentences on separate lines first, doing that conversion manually or in a text editor before pasting here will give the sorter proper line-by-line items to work with.

How does the Shuffle option generate random order, and is it truly unbiased?

Shuffle implements the Fisher-Yates algorithm, the standard method computer scientists use for unbiased list randomization: it walks the list from the last item to the first, and at each step swaps the current item with a randomly chosen item from the remaining unshuffled portion, using the browser's built-in random number generator. This guarantees that every one of the n-factorial possible orderings of your list is equally likely to occur, unlike naive approaches such as sorting by a randomly assigned key per item, which can produce measurably skewed distributions on certain list sizes.

This makes Shuffle suitable for genuinely fairness-sensitive uses — randomizing giveaway or raffle entries, quiz and worksheet question order, or the sequence of items in an A/B test — where a systematic positional bias toward any particular entry would be a real problem rather than a cosmetic one.

Is there a limit to how many lines I can sort?

There's no hard limit enforced by the tool itself, since sorting happens entirely in your browser's memory rather than being uploaded to a server with a request-size cap. In practice you can comfortably sort lists from a handful of lines up to several tens of thousands, limited only by your device's available memory and browser tab performance rather than any restriction we impose. Very large pastes — tens of megabytes of text — may feel briefly less responsive while the browser processes the string, but there is no artificial cutoff.

For very large exports, it's worth running Remove blank lines and Remove duplicates first, since a shorter, cleaner list sorts faster and is considerably easier to review and spot-check afterward than the raw export.

Why did my list keep its original order for items that look identical after sorting?

This is expected behavior called a stable sort. When two lines are exactly equal under the current comparison rules — for example, "Apple" and "apple" when case-sensitivity is off, or two lines with the same length when sorting by length — a stable sort preserves their original relative order rather than shuffling them arbitrarily. Modern JavaScript engines guarantee this behavior for the sorting method this tool relies on.

This matters most when sorting by length or by a leading number, where many lines can legitimately tie: a stable sort means that among all lines of, say, exactly 12 characters, they'll appear in the same relative sequence as they did in your original paste, which keeps the output predictable and reproducible if you sort the same list twice.