Categories

Sort Text

Sort lines of text alphabetically, numerically, or by length

Sort Type

Sort Order

Options

Input

Output

Sort Lines of Text Online

This free online sorting tool arranges the lines of any text alphabetically, numerically, or by line length, in ascending or descending order. It is handy for alphabetizing name lists, ordering CSV fragments, organizing to-do lists, sorting log output, or tidying configuration files without opening a spreadsheet.

Optional switches let you ignore case while sorting, trim leading and trailing whitespace from each line, and remove empty lines. All processing happens in your browser — nothing you paste is sent anywhere.

How to use Sort Text

  1. Paste the lines you want to sort into the Input box (one item per line).
  2. Choose a sort type: Alphabetical, Numeric, or Line Length.
  3. Choose Ascending (A to Z, 0 to 9) or Descending (Z to A, 9 to 0).
  4. Optionally enable Ignore case, Trim whitespace, or Remove empty lines.
  5. Press Process, then copy or download the sorted result.

Sort types explained

  • Alphabetical — compares lines using locale-aware string comparison, the same ordering a dictionary uses.
  • Numeric — parses the number at the start of each line and sorts by its value, so 9 comes before 10 (a plain text sort would put "10" first).
  • Line Length — orders lines by their number of characters, useful for spotting outliers or organizing word lists.

Related terminology

Lexicographic order
Ordering strings character by character, the way words are arranged in a dictionary. "Alphabetical" sorting is lexicographic.
Natural / numeric sort
Ordering that compares embedded numbers by value rather than character by character, so item2 comes before item10.
Collation
The set of language-specific rules that determine how characters compare, e.g. how accented letters are ordered.

Frequently asked questions

How do I alphabetize a list online?
Paste your list with one item per line, keep the default Alphabetical sort type and Ascending order, and press Process. The lines are rearranged from A to Z.
Why does a normal sort put 10 before 9?
Plain text sorting compares character by character, and the character "1" comes before "9". Use the Numeric sort type so lines are compared by their numeric value instead.
Can I sort in reverse (Z to A)?
Yes — select Descending under Sort Order to reverse the result of any sort type.
Does sorting remove duplicate lines?
No, sorting only reorders lines. To deduplicate, use the separate Remove Duplicates utility, which offers case- and whitespace-insensitive matching.

Related tools