Free Sort Lines Alphabetically
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-aware sorting where numbers are ordered by their actual value instead of alphabetically.
Formula & method
Paste or type multiple lines into the text area. Choose your sort order (A-Z ascending or Z-A descending), 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
- Input
- banana apple cherry
- Result
- apple banana cherry
- Why
- Lines are sorted in standard A-Z order, comparing the first character of each word.
- Input
- Zebra apple ZEBRA Apple banana
- Result
- Zebra ZEBRA banana apple Apple
- Why
- Z-A reverse sort ignoring case treats 'Zebra' and 'ZEBRA' as equal (sorts together), then 'apple' and 'Apple' together. Enable case-insensitive to group them, or leave it off to use ASCII order where uppercase comes before lowercase.
- Input
- file10.txt file2.txt file10.txt file1.txt
- Result
- file1.txt file2.txt file10.txt
- Why
- Numeric sort orders 'file1' before 'file2' before 'file10' (by numeric value, not alphabetically where '10' would come first). Remove duplicates flag eliminates the second 'file10.txt'.
When to use this tool
- Organizing lists of names, items, or categories alphabetically for reports, inventories, or documentation.
- Cleaning up disorganized data from spreadsheets, exported logs, or form submissions by sorting and removing duplicate entries.
- Preparing sorted lists for code, configuration files, or URLs where consistent ordering helps with version control diffs and readability.
Common mistakes
- Forgetting to enable numeric sort when sorting filenames or version numbers: 'file10' will appear before 'file2' in standard alphabetical mode because '1' comes before '2' in ASCII, even though 10 > 2 as numbers.
- Not enabling case-insensitive when you have mixed case text: 'apple', 'Apple', and 'APPLE' will be sorted separately and uppercase letters will appear first in ASCII order rather than grouping together.
- Assuming duplicate removal only works for exact matches: the tool only removes completely identical lines. If lines differ by whitespace, capitalization (without case-insensitive mode), or any character, they are treated as unique.
Frequently asked questions
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 extracts numbers and orders by their value: 2 < 10. Use numeric sort for filenames, version numbers, or any text with embedded numbers.
How does case-insensitive sorting work?
It treats 'A' and 'a' as equivalent for sorting purposes. Lines are still returned with their original case. Without it, uppercase ASCII values (65-90) sort before lowercase (97-122).
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 & references
External references open in a new tab. We are independent and not affiliated with these organizations.
- ✓ Free to use
- ✓ No sign-up required
- ✓ Runs entirely in your browser — nothing is uploaded.
- ✓ Formula and method shown above
Provided “as is” for general information only — results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.
Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.
Related tools
Embed this tool on your site
Free to embed, no sign-up. Paste this code where you want the sort lines alphabetically to appear: