Sort Lines

Sort lines alphabetically, numerically or by text length.

Input Text

Enter one item per line to sort.

About Sort Lines

Sort Lines arranges text line by line using alphabetical, numerical or length-based sorting. It is useful for cleaning lists, URLs, IDs, configuration data and other text-based content.

How to use Sort Lines

  1. Paste your text into the input area.
  2. Select the sorting method you want to use.
  3. Choose whether sorting should be case sensitive.
  4. Enable Trim whitespace to remove spaces around each line before sorting.
  5. Enable Remove empty lines if blank lines should be excluded.
  6. Click Sort Lines to generate the sorted result.

What does Sort Lines do?

Sort Lines rearranges text so that each line follows the sorting method you select. The tool can sort alphabetically, numerically, or according to the number of characters in each line.

Sorting options

OptionDescriptionExample
A → ZAlphabetical ascending orderapple, banana, orange
Z → AAlphabetical descending orderorange, banana, apple
0 → 9Numeric ascending order2, 10, 100
9 → 0Numeric descending order100, 10, 2
Shortest → LongestSort by character countcat, apple, banana
Longest → ShortestSort by character count in reversebanana, apple, cat

Alphabetical sorting

Alphabetical sorting compares text values and arranges them from A to Z or Z to A. When Case sensitive is disabled, uppercase and lowercase letters are compared without treating their case as different.

banana

apple

orange

Using A → Z sorting produces:

apple

banana

orange

Numeric sorting

Numeric sorting treats each line as a number instead of comparing it as ordinary text. This is useful when sorting IDs, quantities, scores or other numeric values.

100

2

25

7

With numeric ascending sorting, the result becomes:

2

7

25

100

Sort by text length

Length sorting arranges lines according to the number of characters they contain. You can sort from the shortest line to the longest or reverse the order.

Case-sensitive sorting

When Case sensitive is enabled, uppercase and lowercase letters are treated according to their actual text values during alphabetical sorting. When disabled, the comparison uses lowercase versions of the lines.

Trim whitespace

When Trim whitespace is enabled, spaces and tabs at the beginning and end of each line are removed before the sorting operation. This can make copied or manually entered lists more consistent.

When should you sort lines?

  • Sorting lists of names or items
  • Organizing URLs or domains
  • Sorting IDs or numeric values
  • Preparing text for further processing
  • Cleaning copied data from spreadsheets
  • Organizing configuration or text-based data

Is my text uploaded to a server?

No. Sorting is performed directly in your browser using JavaScript. Your input text is not sent to a server by this tool.

Input limit

The input and result fields support up to 100,000 characters. Larger text may require additional processing resources depending on your browser and device.