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
- Paste your text into the input area.
- Select the sorting method you want to use.
- Choose whether sorting should be case sensitive.
- Enable Trim whitespace to remove spaces around each line before sorting.
- Enable Remove empty lines if blank lines should be excluded.
- 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
| Option | Description | Example |
|---|---|---|
| A → Z | Alphabetical ascending order | apple, banana, orange |
| Z → A | Alphabetical descending order | orange, banana, apple |
| 0 → 9 | Numeric ascending order | 2, 10, 100 |
| 9 → 0 | Numeric descending order | 100, 10, 2 |
| Shortest → Longest | Sort by character count | cat, apple, banana |
| Longest → Shortest | Sort by character count in reverse | banana, 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.