Sort Lines

Sort lines alphabetically — with options for case, reverse and numeric order — instantly in your browser. By default it sorts character by character.

Text Tools Free No upload Instant

Loading Sort Lines…

Your browser is preparing the tool. It runs 100% locally.

Quick Answer

Paste a list and the tool sorts the lines alphabetically. By default it sorts character by character (lexicographically), so 10 comes before 9 and capitals come before lower-case letters. Tick numeric to sort by value instead, ignore case to mix cases, or reverse for Z to A. Everything runs in your browser; nothing is uploaded.

What the Sort Lines Does

This tool puts a list of lines in order. The default is alphabetical, comparing the lines letter by letter, and three switches let you change that: ignore case, reverse the order, or sort the lines as numbers.

It is the quick way to alphabetise a list, order names or terms, or arrange numbers — turning a jumbled block of lines into a tidy, sorted one.

How It Works

By default the tool sorts the lines lexicographically: it compares them character by character from the start, using the underlying character order. That means digits and capital letters come before lower-case ones, and numbers are ordered by their first digit, not their value — so 10 sorts before 9.

The options change this. Ignore case treats upper and lower case the same, so words sort the way a dictionary would. Numeric reads the number at the start of each line and sorts by its actual value, putting 9 before 10. Reverse flips whatever order you have chosen, giving Z to A or largest to smallest.

Processing pipeline

  1. Split into lines. Break the text into separate lines to be ordered.
  2. Choose the comparison. Sort character by character, ignoring case if set, or by numeric value if set.
  3. Sort the lines. Order the lines according to the chosen comparison.
  4. Reverse if requested. Flip the order to descending when the reverse option is on.

Sorting order

default : character by character (lexicographical) — 10 before 9, capitals before lower-case numeric : by the number at the start of each line — 9 before 10 ignore case : upper and lower case treated the same reverse : flip the order (Z to A, or largest first)
Worked example
lines 10, 9, 100 → default: 10, 100, 9 · numeric: 9, 10, 100

The default sorts text character by character, so numbers are ordered by their first digit. Use the numeric option to sort by value, and ignore case for dictionary-style ordering.

Standards & references

  • Lexicographical order — Comparing strings character by character from left to right, using the character set's order. It is the default, and it sorts numbers by their first digit rather than their value.
  • Numeric (natural) order — Sorting by the actual value of the number on each line, so 9 comes before 10. The numeric option uses this to avoid the counter-intuitive results of plain text sorting.
  • Case in sorting — By default, capital letters sort before lower-case ones because of their position in the character set. The ignore-case option removes that distinction for dictionary-style ordering.

Accuracy & Limitations

The sort is exact and consistent for the option you choose. The same input and settings always give the same order, so the result is reliable.

The default is lexicographical, which can surprise people with numbers and cases: 10 sorts before 9, and Banana sorts before apple because capitals come first. Turn on numeric to sort numbers by value, and ignore case to sort words as a dictionary would.

Numeric sorting reads the number at the start of each line. A line that does not begin with a number, or mixes text and numbers, may not sort as expected in numeric mode, since only the leading value is compared.

It sorts whole lines as they are. It does not sort by a column within each line, ignore leading words, or sort sub-parts — for those, you would rearrange the data first. Reverse simply flips the chosen order.

Real-World Use Cases

Alphabetising a list

Put names, terms or items in A to Z order.

Ordering numbers

Sort a list of numbers by value with the numeric option.

Tidying data

Turn a jumbled block of lines into a sorted one.

Preparing a reference

Sort entries for a glossary, index or list.

When to use it — and when not to

Good for

  • Alphabetising a list of lines
  • Numeric sorting by value
  • Reverse (Z to A) ordering
  • Case-insensitive, dictionary-style sorting

Not the best choice for

  • Sorting by a column within each line
  • Ignoring leading words (like a, the)
  • Mixed text-and-number natural sort
  • Keeping a custom or original order

To sort by a column, rearrange the data so the sort key comes first. For full natural sorting of mixed text and numbers, a dedicated natural-sort tool handles version-like strings better. This tool sorts whole lines.

Frequently Asked Questions

Why does 10 sort before 9?
Because the default is a character-by-character (lexicographical) sort, which compares the first character first. Since 1 comes before 9, every number starting with 1 sorts before 9. Use the numeric option to sort by value instead.
How do I sort numbers by their value?
Turn on the numeric option. It reads the number at the start of each line and orders by the actual value, so 9 comes before 10 and 100 comes last.
Why do capital letters come first?
In the character set used for sorting, capital letters come before lower-case ones, so a default sort puts Banana before apple. Switch on ignore case to sort words the way a dictionary does.
What does ignore case do?
It treats upper and lower case as equivalent when comparing, so words sort alphabetically regardless of capitalisation — apple, Banana, cherry rather than Banana, apple, cherry.
What does reverse do?
It flips the order you have chosen. With a normal sort it gives Z to A; with numeric it gives largest to smallest. It reverses whatever the other settings produce.
Does it remove duplicate lines while sorting?
No. It only orders the lines; duplicates remain. To remove repeats as well, run the list through a remove-duplicate-lines tool before or after sorting.
Can it sort by a column in each line?
Not directly. It sorts whole lines from the first character. To sort by a particular column, move that column to the start of each line first, then sort.
What happens to blank lines?
Blank lines sort to the start in a normal sort, since an empty line compares as the smallest. In reverse they move to the end.
Does numeric mode handle decimals and negatives?
It reads the leading number on each line, including decimals and a leading minus sign, and sorts by value. Lines that do not start with a number may not place as expected.
Is the sort stable for equal lines?
Identical lines stay together; their relative order does not matter since they are the same. For lines that compare equal under ignore case, the result groups them together.
Is my data uploaded?
No. The sort runs entirely in your browser. Nothing is sent to a server, so your list stays on your device.
How do I sort version numbers like 1.2 and 1.10 correctly?
Plain and numeric sorting both struggle with multi-part versions, since 1.10 is not a single number. A dedicated natural-sort or version-aware tool is the right choice for version strings.

References

Sorts lines lexicographically by default (character by character, case-sensitive), with options to ignore case, reverse, or sort numerically by value.

PopularHot

Word Counter

Clean and transform text with Word Counter — instant results, fully in-browser.

TextOpen Tool
Popular

Character Counter

Character Counter instantly as you type — free, private and lightning fast.

TextOpen Tool
Popular

Case Converter

Case Converter instantly as you type — free, private and lightning fast.

TextOpen Tool
Trending

Lorem Ipsum Generator

Clean and transform text with Lorem Ipsum Generator — instant results, fully in-browser.

TextOpen Tool
Trending

Text Diff Checker

Text Diff Checker online with no limits, no signup and no data leaving your browser.

TextOpen Tool

Remove Duplicate Lines

Remove Duplicate Lines online with no limits, no signup and no data leaving your browser.

TextOpen Tool

Ready to try the Sort Lines?

It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.