# Sort Lines

> Sort text lines alphabetically, numerically, by length, or in reverse order. Handles large lists instantly.

- Open the tool: https://overtooled.com/sort-lines
- Category: Text Tools
- Privacy: Runs entirely in your browser. Nothing is uploaded, no account is needed, and it works offline once loaded.
- Price: free, no sign-up
- Keywords: sort, alphabetical, order, lines, reverse

## In short

Sort lines alphabetically, numerically, by length, or reversed.

## Overview

Sorts lines of text alphabetically, by length or numerically, or reverses their order. Results update live. Use it to order lists, names, keywords or numbers pasted one per line.

## Features

- Six modes: A-Z, Z-A, Short first, Long first, Numeric and Reverse order
- Alphabetical modes use locale-aware comparison (Intl.Collator)
- Case sensitive toggle (off by default) for the alphabetical modes
- Numeric mode compares the number at the start of each line (thousands commas allowed), ascending; lines without a leading number go last, alphabetically
- Reverse order flips the existing line order without sorting
- Copy and pipeline buttons on the result; Clear button on the input

## How to use it

1. Paste lines to sort, one item per line.
2. Choose a sort mode and, for A-Z or Z-A, the case setting.
3. Copy the sorted result.

## Inputs

- Text with one item per line

## Outputs

- Sorted lines (newline-separated)

## Limits and notes

- Numeric mode reads only a leading number (e.g. "10 apples" is 10; "$5" has none and goes last).
- There is no numeric descending mode; use Numeric and then Reverse order on the result.
- Blank lines are sorted like other lines (they are not removed); a trailing line break stays at the end instead of sorting to the top.
- Alphabetical sorting is not "natural": "item10" sorts before "item2".
- Text is not saved and nothing is uploaded.

## Questions and answers

### How does the Line Sorter work?

The tool splits your text on newlines into an array, then sorts using JavaScript's Array.sort() with a custom comparator for each mode. Alphabetical uses Intl.Collator for proper Unicode ordering, numeric reads the number at the start of each line and puts lines without one last, and length mode compares string lengths. Reverse order flips the existing line order.

### What sort methods are available?

Six: A-Z, Z-A, Short first, Long first, Numeric (smallest to largest), and Reverse order, which flips the current line order without sorting. A Case sensitive toggle applies to the alphabetical modes. For largest-first numbers, sort numerically and then apply Reverse order to the result.

### Does numeric sort handle numbers correctly?

Yes. Numeric sort compares values mathematically, not as text. This means 2 comes before 10, unlike alphabetical sort where "10" would come before "2" because "1" comes before "2".

### Can I sort and remove duplicates at the same time?

You can sort here and then use the Remove Duplicates tool to clean the sorted list. Both tools work instantly.

## Related tools

- [Palindrome Checker](https://overtooled.com/palindrome-checker.md): Check if text reads the same forwards and backwards
- [Remove Duplicate Lines](https://overtooled.com/remove-duplicates.md): Remove duplicate lines from lists and text instantly
- [Reverse Text](https://overtooled.com/reverse-text.md): Reverse entire text, individual words, or characters
- [Text Formatter](https://overtooled.com/text-formatter.md): 36 text transforms: delimiter swaps, line sorting, whitespace cleanup, HTML stripping, email/URL extraction, and more

---
Overtooled: 179 free tools that run in your browser. Index of all tools: https://overtooled.com/llms.txt
