DevToolPal
EN

Sort Lines

Sort lines alphabetically, naturally, numerically or by length, remove duplicates and empty lines, trim or shuffle.

Runs locally, never uploaded

Options

Lines

0 chars · 0 B

Sorted lines

0 chars · 0 B

What it does

Sort Lines puts every line of a text in order. It is the quick way to alphabetize a list of names, sort a column copied from a spreadsheet, order version numbers or file names, clean up a word list, or prepare data before comparing it with another list. Besides sorting, it can remove duplicate lines, drop empty lines, trim stray spaces and shuffle lines into random order.

There are five ways to order lines: alphabetical, natural (numbers inside text compare by value), numeric (by the number each line starts with), by line length, or keep the original order and only clean up. Any of them can be reversed.

How to use

  1. Paste your list into the input, one item per line, or click Sample.
  2. Choose how to sort in Sort by.
  3. Turn on the extra options you need: Reverse order, Ignore case, Remove duplicate lines, Remove empty lines and Trim spaces.
  4. Copy or download the result. Use Random shuffle to draw names or randomize a quiz, and change any option to shuffle again.

Example

The same list sorted two ways:

Input        Alphabetical   Natural
item 10      item 1         item 1
item 2       item 10        item 2
item 1       item 2         item 10

Tips

  • Alphabetical sorting uses character codes, the same order as sort with LC_ALL=C on Linux: uppercase letters before lowercase ones and digits before letters. Turn on Ignore case to mix them.
  • Natural sorting follows Unicode collation rules for English, so accented letters sort next to their base letters.
  • Options are applied in a fixed order: trim, remove empty lines, remove duplicates, sort, then reverse.
  • A trailing line break in your input is kept, so the output can replace the original file without changing its last line.
  • Windows line endings are converted to plain line breaks.

FAQ

› What is the difference between alphabetical and natural sorting?

Alphabetical sorting compares text character by character, so item10 comes before item2 because 1 is smaller than 2. Natural sorting reads runs of digits as numbers, giving item2 before item10, the way people expect file names and version lists to be ordered.

› How does numeric sorting handle lines without a number?

Lines are ordered by the number they start with, including negatives, decimals, exponents and thousands separators such as 1,000. Lines that do not start with a number are placed after all numbered lines and sorted alphabetically.

› Which duplicate is kept when I remove duplicates?

The first occurrence of each line is kept and later copies are removed. With Ignore case on, Apple and apple count as the same line. Turn on Trim spaces as well if lines differ only in leading or trailing spaces.

› Can I remove duplicates without changing the order?

Yes. Choose Keep original order and turn on Remove duplicate lines. The same works for removing empty lines or trimming spaces on their own.

› Is my list uploaded anywhere?

No. Sorting happens in your browser, so even large or private lists never leave your device.