Text Sorter
Free online tool to sort text lines alphabetically or numerically.
📝 Input Text
✨ Sorted Result
Sort text lines alphabetically or numerically. Choose ascending or descending order, and optionally enable case-sensitive sorting.
Key Features
- Alphabetical Sort: Sort text in alphabetical order
- Numerical Sort: Sort numbers correctly by value
- Ascending/Descending: Choose desired sort direction
- Case Sensitive: Case sensitivity option
- Real-time Sorting: See results instantly
- Multi-language Support: Natural sorting for Korean, Japanese, Chinese, etc.
How to Use
Basic Usage
- Enter text in the input area (one per line)
- Select sorting options
- Sorted results appear automatically
- Click "Copy" button to copy results to clipboard
Sorting Options
Sort Order
- Ascending: A→Z, 1→9
- Descending: Z→A, 9→1
Sort Type
- Alphabetical: Regular text sorting
- Numerical: Parse and sort as numbers
Case Sensitive
- Unchecked: Treat "Apple" and "apple" the same
- Checked: Treat "Apple" and "apple" differently
Use Cases
1. Alphabetical Ascending Sort
Input:
Zebra
Apple
Mango
Banana
Output:
Apple
Banana
Mango
Zebra
2. Alphabetical Descending Sort
Input:
Zebra
Apple
Mango
Banana
Output:
Zebra
Mango
Banana
Apple
3. Numerical Ascending Sort
Input:
100
20
3
1000
Output:
3
20
100
1000
Using alphabetical sort would sort as "1000, 100, 20, 3", but numerical sort sorts correctly by value.
4. Korean Sorting
Input:
하늘
가을
나무
다람쥐
Output:
가을
나무
다람쥐
하늘
5. Case Sensitive Sorting
Case Sensitive OFF:
Input: apple, Apple, APPLE
Output: apple, Apple, APPLE (treated as equal)
Case Sensitive ON:
Input: apple, Apple, APPLE
Output: APPLE, Apple, apple (uppercase first)
Practical Application Examples
1. Sort Name Lists
Sort student rosters or customer lists alphabetically:
John Smith
Alice Johnson
Bob Williams
Charlie Brown
2. Sort File Names
Sort file or folder names:
document1.txt
document10.txt
document2.txt
document20.txt
Using numerical sort mode will sort in correct order.
3. Sort Priority
Sort priorities or scores indicated by numbers:
Priority 1: Critical
Priority 10: Low
Priority 5: Medium
Priority 2: High
4. Sort URLs or Domains
Sort website lists alphabetically:
www.example.com
www.google.com
www.amazon.com
www.facebook.com
5. Sort Code Import Statements
Organize import statements in programming:
import React from 'react';
import axios from 'axios';
import lodash from 'lodash';
import moment from 'moment';
Detailed Sorting Mode Explanation
Alphabetical Sort
Uses standard Unicode sorting:
- English: A-Z, a-z
- Korean: 가나다 order
- Japanese: あいうえお order
- Chinese: Based on pinyin or stroke count
Numerical Sort
Converts strings to numbers for sorting:
- "1" < "2" < "10" < "100"
- Non-numeric text is handled with alphabetical sort
// Alphabetical sort (string comparison)
["1", "10", "2", "20"] → ["1", "10", "2", "20"]
// Numerical sort (numeric comparison)
["1", "10", "2", "20"] → ["1", "2", "10", "20"]
Algorithm Explanation
This tool uses JavaScript's localeCompare() and parseFloat():
// Numerical sort
if (sortType === 'numerical') {
return sortOrder === 'asc' ? numA - numB : numB - numA;
}
// Alphabetical sort
const strA = caseSensitive ? a : a.toLowerCase();
const strB = caseSensitive ? b : b.toLowerCase();
return sortOrder === 'asc'
? strA.localeCompare(strB)
: strB.localeCompare(strA);
Performance
- Sort Speed: O(n log n) - standard sorting algorithm
- Processing Capacity: Sorts tens of thousands of lines within 1 second
- Memory Efficiency: Minimal memory usage
Frequently Asked Questions
Q: How are blank lines sorted?
Blank lines are automatically removed. Only lines with content are included in sorting results.
Q: What happens when numbers and text are mixed?
In numerical sort mode, lines convertible to numbers are sorted numerically, the rest are sorted alphabetically.
Q: Do leading/trailing spaces affect sorting?
In the current version, spaces are included in sorting. To remove spaces, use the Whitespace Remover first.
Q: How are special characters sorted?
Special characters are sorted according to Unicode order. They typically appear before or after letters and numbers.
Q: How exactly does case sensitivity work?
- Sensitive OFF: Convert all text to lowercase for comparison
- Sensitive ON: Compare as original (typically uppercase comes before lowercase)
Browser Compatibility
This tool works properly in the following browsers:
- Chrome (all versions) ✓
- Firefox (all versions) ✓
- Safari 10+ ✓
- Edge (all versions) ✓
- Opera (all versions) ✓
🔗 Try These Next
- Duplicate Remover - Remove duplicate lines
- Text Comparison - Compare two texts
- Character Counter - Check text statistics
Practical Tips
1. Sort After Removing Duplicates
To remove duplicates then sort:
- Check "Sort Output" in Duplicate Remover
- Or use this tool after removing duplicates
2. Sort Large Data
When sorting specific columns from Excel or CSV files:
- Copy column from Excel
- Paste into this tool
- Sort then copy back
3. Sort Version Numbers
Use numerical sort mode when sorting version numbers:
v1.0.0
v1.10.0
v1.2.0
v2.0.0
💬 Was this tool helpful?
Feel free to send us your feedback or suggestions anytime!
Privacy
This tool operates entirely on the client side. Your input data is never sent to a server and is processed only in your browser.