Sort Lines

Sort text lines alphabetically, numerically, by length, reverse them, or shuffle randomly. Pure client-side.

About Sort Lines

Paste a list and reorder it eight different ways: alphabetical (A-Z or Z-A), numerical ascending or descending, by length shortest-first or longest-first, fully reversed, or shuffled randomly. Includes case-sensitivity, empty-line removal, and per-line trim options.

Sorting a list sounds obvious until you remember how many ways 'sorted' can mean different things. Alphabetical sort of ['file10', 'file2', 'file1'] produces ['file1', 'file10', 'file2'] by default because '1' comes before '2' character-by-character. Numerical sort on the same list gives ['file1', 'file2', 'file10']. Sorting by length reorders by string size rather than content, useful for ranking responses or trimming verbose rows. This tool exposes all of those modes plus random shuffle and straight reverse.

Alphabetical comparisons use Intl.Collator so locale-aware rules apply: 'ä' sorts near 'a' in German, accented characters are grouped with their base letters, and case folding is configurable. Numerical sort attempts Number() on each line and falls back to locale compare for non-numeric rows so mixed lists stay predictable. Empty-line removal and per-line trim clean up typical paste artefacts (trailing spaces, blank separators) before sorting so the output doesn't surprise you.

How to use the Sort Lines
  1. 1

    Paste your list

    Drop lines into the input. Numeric rows, plain text, or mixed content all work.

  2. 2

    Choose a sort mode

    Pick alphabetical, numerical, length-based, shuffle, or reverse. Toggle case-sensitivity, empty-line removal, and trimming as needed.

  3. 3

    Sort and copy

    Click Sort to see the result. Copy the output with one click and paste it wherever you need the ordered list.

Common use cases

Alphabetize names or terms

Order contributor lists, glossary entries, or bibliography rows before publishing.

Numeric ranking

Sort scores, prices, or IDs so the largest or smallest values appear first without importing into a spreadsheet.

Randomize draw orders

Shuffle a list of participants, teams, or questions for a raffle or quiz without writing code.

Tighten or expand prose

Sort lines by length to spot overly long rows in bullet lists or to find stub entries that need expansion.

Frequently asked questions
Does it sort numerically or like a string?

Both, and you pick. Numerical ascending/descending parses each line with Number(); lines that aren't numbers fall back to alphabetical order so the whole list still sorts predictably.

How does case sensitivity work?

With case-sensitive off, 'apple' and 'Apple' are treated as equivalent during comparison, so their relative order depends only on the sort mode and surrounding rows. Turning it on uses exact character comparison.

Is the shuffle cryptographically random?

No. It uses Math.random() with a Fisher-Yates algorithm, which is good enough for raffles, sample ordering, and any non-security use. Don't use it to pick cryptographic keys.

Does it handle non-English characters?

Yes. Alphabetical sort uses Intl.Collator, so accented characters, German umlauts, and most Latin-script languages sort by their locale-aware rules rather than raw code point.

Does anything leave my browser?

No. Sorting is a pure JavaScript operation running locally. Your list is never uploaded or logged.

text