# Sort Lines Alphabetically

URL: https://hifreetools.com/text/sort-lines

> Sort multiple lines of text in alphabetical order with powerful options including reverse sorting, case-insensitive mode, numeric sorting, and automatic duplicate removal. Process runs instantly in your browser—nothing is uploaded.

## Quick answer

Paste lines of text and sort them alphabetically A-Z or Z-A. The tool also removes duplicates, handles case-insensitive sorting, and supports numeric sorting where lines that start with a number are ordered by its value instead of alphabetically.

Paste or type multiple lines into the text area. Lines sort A-Z (ascending) by default; tick Z → A for descending order, then enable any combination of options: case-insensitive to ignore uppercase/lowercase differences, numeric sort to order numbers by value, or remove duplicates to keep only unique lines. Results display instantly as you type or adjust settings.

## Examples

- Basic Alphabetical Sort: banana apple cherry → apple banana cherry
- Case-Insensitive Reverse Sort with Case Variants: Zebra apple ZEBRA Apple banana → ZEBRA Zebra banana Apple apple
- Numeric Sort Removing Duplicates: 10 apples 2 pears 10 apples 1 plum → 1 plum 2 pears 10 apples

## FAQ

**Does this tool upload my text to a server?**
No. All sorting happens in your browser. Your text never leaves your device.

**What's the difference between standard alphabetical sort and numeric sort?**
Standard sort compares characters left-to-right: '10' comes before '2' because '1' < '2'. Numeric sort reads the number at the start of each line and orders by its value: 2 < 10. Use it for lists that begin with numbers; lines that start with letters are still sorted as text.

**How does case-insensitive sorting work?**
It treats 'A' and 'a' as equivalent for sorting purposes. Lines are still returned with their original case. It is on by default; without it, words still sort alphabetically and only same-spelling ties are ordered by case.

**Can I sort in reverse (Z-A) order?**
Yes. Choose the Z-A option to reverse the sort direction. This works with any combination of other options like numeric sort or duplicate removal.

**What counts as a duplicate for removal?**
An exact match: the entire line must be identical, character-for-character, including spacing. 'apple' and 'apple ' (with trailing space) are different and both kept.

**Can I sort numbers that have leading zeros or mixed formats?**
Numeric sort recognizes numbers regardless of leading zeros. '007' and '7' are treated as the same value (7) and sorted together, preserving the original text format in the output.


## Sources

- [MDN: String localeCompare() and Collation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)
- [Unicode Collation Algorithm (Unicode Consortium)](https://unicode.org/reports/tr10/)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Sort Lines Alphabetically", https://hifreetools.com/text/sort-lines
