Line Sorter

Sort lines alphabetically, naturally, numerically, by length, in reverse order, or at random. It is useful for lists, file names, tags, and one-item-per-line data.

Runs in your browser. Your data is not uploaded.
Updated

Your text

Settings

Updates as you type for smaller inputs.

Sorted lines

Sorted lines will appear here
  1. Paste lines, upload a file, or load a URL
  2. Pick a sort mode and options
  3. Copy or download the sorted list

How to use the Line Sorter

  1. Paste a list with one item per line, or upload a text file.
  2. Choose the sort mode: A to Z, Z to A, natural, numeric, by length, random, or reverse.
  3. Turn on Ignore case if upper and lower case should sort together.
  4. Copy or download the sorted result.

How it works

Alphabetic modes compare each line with a locale-aware text comparison, so accented characters and case behave more naturally than a plain byte sort. Natural sort treats digit runs as numbers, which is why file2 comes before file10.

  • Numeric mode tries to read each trimmed line as a number. Real numbers are sorted by value. Lines that are not numbers fall back to text order.
  • Length mode sorts by character count, shortest first.
  • Reverse keeps the current order and flips it.
  • Random shuffles the lines into a new random order each time you run it.

Examples

  • Natural sort of file10, file2, file1 gives file1, file2, file10.
  • Numeric sort of 20, 3, 100 gives 3, 20, 100.
  • Reverse order of red, green, blue gives blue, green, red.

Limitations

  • The tool sorts whole lines only. It does not sort comma-separated values inside one line.
  • Random mode is different on each run, so it is not suitable when you need a repeatable order.
  • Numeric mode expects one number per line. A line such as item 12 falls back to text comparison.
  • Files up to 10 MB are supported.

Frequently asked questions

What is natural sort?

Natural sort reads embedded digits as numbers, so values like file2 and file10 come out in the order a person expects.

Will this remove duplicate lines too?

No. Sorting keeps every line. To drop repeats first, use Remove Duplicate Lines.

Why are upper-case and lower-case lines apart?

That happens when Ignore case is off. Turn it on if Apple and apple should sort together.

Often used together with the Line Sorter.

  • CSV Cleaner

    Cleans CSV data by trimming cells, removing empty rows, deduping rows, and fixing delimiter issues.

  • Text Merger

    Joins multiple text blocks with a separator or merges them line by line.