Text Sorter: Sort Lines Alphabetically or Numerically

Sort lines alphabetically, numerically, by length or in reverse.

Text Tools Free, no sign-up Runs in your browser

Text Sorter tool

Extra rules
0 lines

About the Text Sorter

Text Sorter rearranges a list of lines into the order you choose. Paste the list, pick a sort mode and the reordered version appears below. It handles the four orderings people actually need: alphabetical in both directions, numeric in both directions, by line length, and a plain reversal of whatever order the list already has.

Alphabetical sorting uses the browser's locale-aware comparison, so accented letters land next to their unaccented counterparts rather than being pushed to the end. Numeric sorting reads the first number it finds on each line, which means a list like Item 2 and Item 10 sorts in the sensible order rather than putting 10 before 2.

Extra switches let you ignore capitalisation while sorting, drop blank lines and remove duplicates in the same pass, so a messy pasted list can be cleaned and ordered in one step.

How to use the Text Sorter

  1. Paste your linesOne item per line in the input box.
  2. Choose a sort orderPick alphabetical, numeric, by length or reverse from the list of modes.
  3. Add any extra rulesOptionally ignore case, remove empty lines or remove duplicates while sorting.
  4. Copy the sorted listTake the result with the copy button or download it as a text file.

Features

  • Alphabetical A-Z and Z-A with locale-aware comparison
  • Numeric ascending and descending
  • Sort by line length, shortest or longest first
  • Reverse the current order without sorting
  • Optional case-insensitive comparison
  • Optional blank-line and duplicate removal
  • Copy and download the result

Who uses this tool

The text sorter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Alphabetising a glossary, index or name list
  • Ordering keyword lists by length to spot long-tail phrases
  • Sorting numeric IDs or prices pasted from a report
  • Reversing a chronological list to put newest first
  • Tidying and ordering a list in a single pass

Frequently asked questions

How does numeric sorting handle lines with text in them?

The first number found on each line is used as the sort key, so Item 2 sorts before Item 10. Lines containing no number at all are grouped together at the end, keeping their original relative order.

Is alphabetical sorting case-sensitive?

By default capital letters are compared using locale rules, which usually groups them with their lowercase equivalents. Switching on the ignore-case option makes the comparison explicitly case-blind.

Can I sort and deduplicate at the same time?

Yes. Tick the remove duplicates option and each line will appear only once in the sorted output. For deduplication without sorting, use the Remove Duplicate Lines tool.

What does sorting by length do with ties?

Lines of equal length keep their original relative order, which makes the result predictable when you sort the same list twice.

Does sorting change the text of my lines?

No. Only the order changes. Characters, spacing inside each line and punctuation are left exactly as pasted, unless you enable the blank-line or duplicate options.

Will it handle a list with thousands of lines?

Yes. Sorting runs in your browser and handles large lists quickly. Nothing is uploaded, so list size is limited only by your device's memory.

If the text sorter is not quite what you need, these other free tools solve closely related problems.

Remove Duplicate Lines

Deduplicate any list of lines, with case-sensitive and empty-line options.

Text Tools Use tool

Text Cleaner

Tidy messy pasted text: extra spaces, empty lines, breaks and special characters.

Text Tools Use tool

Text Reverser

Flip text backwards at character, word or line level in one click.

Text Tools Use tool

Word Counter

Live word, character, sentence and paragraph counts with a reading-time estimate.

Text Tools Use tool

Character Counter

Character, word, line and paragraph counts that update as you type.

Text Tools Use tool