Skip to main content
Text tools100% FreeInstant

Line Sorter: Sort Lines Alphabetically, by Number or Length

This free line sorter puts the lines of your text in order. Sort A to Z or Z to A, by number, by length, in reverse or at random, and choose whether to ignore case, trim spaces and remove duplicate lines.

By Debmedia Technologies LLP · Kolkata, India · Updated

What Is It and When Do You Need It?

Sorting a list by hand is slow, and spreadsheets are overkill for a few lines. A line sorter orders names, URLs, keywords, file names or numbers in a second.

Paste your lines, pick a sort and copy the result.

How to Use This Tool

  1. Paste your list, one item per line.
  2. Choose the sort order.
  3. Choose how to treat case, duplicates and spaces.
  4. Press Sort and copy the result.

How the Calculation Works

Lines are split on line breaks. Alphabetical sorts use locale-aware comparison. Natural sort treats runs of digits as numbers. Number sorts use the first number in each line. Length sorts use the number of characters. Shuffle uses the Fisher-Yates method with random numbers.

Worked Example

The lines banana, Apple, cherry, apple sorted A to Z ignoring case give Apple, apple, banana, cherry. With duplicates removed, one of the two apples remains.

Common Uses

  • Sorting keywords, names and URLs.
  • Cleaning lists before import.
  • Ordering file names and versions.
  • Making random orders.

Tips and Common Mistakes

  • Use natural order for names with numbers.
  • Trim spaces to avoid false differences.
  • Remove duplicates after sorting to see what was dropped.

Next, you may need the text repeater, anagram checker, acronym generator, character counter.

Everything runs in your browser. Nothing you type is uploaded, stored or sent to any outside service.

Frequently Asked Questions

It sorts numbers inside text by their value, so file2 comes before file10, instead of after it as in plain alphabetical order.
The first number found in each line is used. Lines with no number are placed last.
Yes. Use Z to A, largest first or Reverse the order, depending on what you need.
Yes, if you choose Remove. With Ignore case, Apple and apple count as the same line.

Disclaimer: results are calculated in your browser from the numbers you enter. Check important results before you rely on them for money, health, safety or legal decisions.