Skip to main content

Free Text Sorter

Sort lines of text alphabetically, by length, numerically, or randomly. Remove duplicates, trim whitespace, and shuffle lists.

Works offline once loaded
Sorted Β· 0 lines
Sorted output will appear here…

Common uses

  • Sort and Organise Lists AlphabeticallySort grocery lists, to-do items, names, or any bulleted list into alphabetical order instantly.
  • Clean and Deduplicate Data LinesRemove duplicate lines, trim whitespace, and normalise text data from CSV exports and logs.
  • Sort Import Statements and Code ListsSort import statements, CSS class lists, JSON keys, or any code list into a consistent order.
  • Sort a List of Names AlphabeticallyAlphabetise attendee lists, team rosters, student names, and credit lists by first or last name.
  • Randomly Shuffle a ListRandomly shuffle names, items, or entries for fair ordering, random assignments, or game setup.

How It Works

Sorting runs entirely in your browser using JavaScript's built-in Intl.Collator API β€” no server, no library, no upload. Every sort order, from alphabetical to natural number sorting, is computed on the spot as you type or change options.

  1. 1
    Input split into lines
    Your pasted text is split on newline characters. Optional pre-processing runs first: leading and trailing whitespace is trimmed from each line, and empty lines are discarded β€” both configurable.
  2. 2
    Intl.Collator handles ordering
    For alphabetical and natural sorts, the browser's built-in Intl.Collator is initialized with your current site locale so accented characters (Γ₯, Γ€, ΓΆ, etc.) sort in the correct language order. The 'natural' mode sets the numeric flag, so 'file2' ranks before 'file10' rather than treating digits as plain characters.
  3. 3
    Comparison keys strip noise
    Before comparison, each line can optionally have leading articles (the, a, an) and non-alphanumeric punctuation removed from its sort key β€” the original line text is kept intact in the output, only the key used for ordering is modified.
  4. 4
    Shuffle uses cryptographic randomness
    The random shuffle mode calls crypto.getRandomValues to generate an array of random 32-bit integers, then runs a Fisher-Yates shuffle over the lines using those values β€” avoiding the bias that comes with Math.random()-based approaches.

Related Tools

Frequently Asked Questions