⚡ BreezyTools Pro — Ad-free experience across all 200+ tools. Less than a coffee a month → Learn More

Sort Lines

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

Sorted

Sort Lines of Text Online

Paste any list with one item per line and this tool puts it in order: alphabetically, alphabetically while ignoring case, by the number at the start of each line, or by line length. Tick Reverse to flip any of those orders. The sorted list appears instantly in the output box, ready to copy. It's handy for alphabetizing names, glossary terms, or reference lists; organizing keyword and URL lists for SEO work; tidying lists of CSS properties or import statements; and putting numbered data in order.

How to Sort Your Lines

  1. Paste your list into the Input box, one item per line.
  2. Choose a mode from the Sort by menu.
  3. Tick Reverse for Z to A, largest-first, or longest-first order.
  4. Click Copy to copy the sorted list from the output box.

The Four Sort Modes

  • Alphabetical (A→Z): compares lines by their raw character codes. It's fast and predictable, but uppercase letters come before all lowercase letters, digits come before letters, and accented letters such as É come after z. "Zebra" sorts above "apple" in this mode.
  • Alphabetical, ignore case: uses your browser's language-aware comparison and ignores differences in case and accents, so "apple", "banana", "Zebra" come out the way a person would expect and "Éclair" lands among the E words. This is usually the best choice for names and ordinary words.
  • Numerical: reads the number at the very start of each line, including decimals and minus signs, and sorts by its value. This avoids the classic "10 before 9" problem of alphabetical sorting. Lines that don't start with a number are treated as 0.
  • Length (shortest first): sorts by the number of characters in each line, spaces included.

In every mode, lines that compare as equal keep the order they had in your input. Reverse flips the whole result, including the order of those tied lines.

Example

Here is how the same four lines, "10 apples", "9 pears", "Banana", and "apple", come out in each mode:

ModeResult (top to bottom)
Alphabetical (A→Z)10 apples, 9 pears, Banana, apple
Alphabetical, ignore case10 apples, 9 pears, apple, Banana
NumericalBanana, apple, 9 pears, 10 apples
Length (shortest first)apple, Banana, 9 pears, 10 apples

Tips for Clean Results

  • Watch for a trailing blank line. If your text ends with a line break, the empty last line sorts to the top in the alphabetical and length modes. Delete it before sorting.
  • Remove thousands separators for numerical sorting. The number stops at the first character that isn't part of it, so "1,000" is read as 1. A line that starts with a currency sign, such as "$7", has no leading number and is treated as 0.
  • Only the leading number counts. "Chapter 12" is treated as 0 in numerical mode because the number isn't at the start of the line.
  • Leading spaces affect alphabetical order. A line that starts with a space sorts before lines that start with letters. Trim indentation first if that isn't what you want.
  • Duplicates are kept. Sorting never deletes lines. To drop repeats, use Remove Duplicate Lines.

Frequently Asked Questions

Why does "Zebra" come before "apple"?

The plain Alphabetical mode compares character codes, and every uppercase letter has a lower code than every lowercase letter. Switch to "Alphabetical, ignore case" to sort words the way a dictionary would.

Why do lines without numbers appear at the top in numerical mode?

Lines that don't begin with a number are treated as 0, so they sort before positive numbers and after negative ones. Among themselves they keep their original order.

How do I sort from Z to A or from largest to smallest?

Choose the mode you want and tick the Reverse checkbox. Alphabetical becomes Z to A, Numerical becomes largest first, and Length becomes longest first.

Does sorting remove duplicate or blank lines?

No. Every line in the input appears in the output, including duplicates and blank lines. Blank lines usually end up at the top because they are the shortest and come first alphabetically.

Does case-insensitive sorting work with other languages?

Yes. That mode uses your browser's built-in language rules, so accented and non-English letters are placed sensibly. Alphabetical conventions differ between languages, so the exact position of a few letters can depend on your browser's language setting.

Is my list saved or uploaded?

No. Sorting happens in your browser, and the list isn't sent anywhere or stored. Copy the sorted result before you close the page.

Love using BreezyTools?

Go Pro for an ad-free experience, priority features, and support independent development — for less than a coffee a month.

Upgrade to Pro →