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 numerically correct
- Ascending/Descending: Choose your preferred sort direction
- Case Sensitive: Case sensitivity option
- Real-time Sorting: See results immediately upon input
- Multilingual Support: Natural sorting for Korean, Japanese, Chinese, etc.
How to Use
Basic Usage
- Enter text in the input area (one per line)
- Select sort options
- Sorted results are displayed automatically
- Click the "Copy" button to copy results to clipboard
Sort 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: Treats "Apple" and "apple" the same
- Checked: Treats "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
Alphabetical sorting would result in "1000, 100, 20, 3", but numerical sorting correctly sorts by numeric value.
4. Korean Sorting
Input:
하늘
가을
나무
다람쥐
Output:
가을
나무
다람쥐
하늘
5. Case Sensitive Sorting
Case Sensitive OFF:
Input: apple, Apple, APPLE
Output: apple, Apple, APPLE (all treated the same)
Case Sensitive ON:
Input: apple, Apple, APPLE
Output: APPLE, Apple, apple (uppercase first)
Practical Application Examples
1. Sorting Name Lists
Sort student rosters or customer lists alphabetically:
John Smith
Alice Johnson
Bob Williams
Charlie Brown
2. Sorting File Names
Sort file or folder names:
document1.txt
document10.txt
document2.txt
document20.txt
Using numerical sort mode sorts them in the correct order.
3. Priority Sorting
Sort priorities or scores represented by numbers:
Priority 1: Critical
Priority 10: Low
Priority 5: Medium
Priority 2: High
4. URL or Domain Sorting
Sort website lists alphabetically:
www.example.com
www.google.com
www.amazon.com
www.facebook.com
5. Code Import Statement Sorting
Organize import statements when programming:
import React from 'react';
import axios from 'axios';
import lodash from 'lodash';
import moment from 'moment';
Detailed Sort Mode Explanation
Alphabetical Sorting
Uses standard Unicode sorting:
- English: A-Z, a-z
- Korean: alphabetical order (가나다)
- Japanese: あいうえお order
- Chinese: by pinyin or stroke count
Numerical Sorting
Converts strings to numbers for sorting:
- "1" < "2" < "10" < "100"
- Non-numeric text is handled with alphabetical sorting
// Alphabetical sorting (string comparison)
["1", "10", "2", "20"] → ["1", "10", "2", "20"]
// Numerical sorting (numeric comparison)
["1", "10", "2", "20"] → ["1", "2", "10", "20"]
Algorithm Explanation
This tool uses JavaScript's localeCompare() and parseFloat():
// Numerical sorting
if (sortType === 'numerical') {
return sortOrder === 'asc' ? numA - numB : numB - numA;
}
// Alphabetical sorting
const strA = caseSensitive ? a : a.toLowerCase();
const strB = caseSensitive ? b : b.toLowerCase();
return sortOrder === 'asc'
? strA.localeCompare(strB)
: strB.localeCompare(strA);
Performance
- Sorting Speed: O(n log n) - standard sorting algorithm
- Processing Capacity: Sorts tens of thousands of lines in under 1 second
- Memory Efficient: Uses minimal memory
Frequently Asked Questions
Q: How are blank lines sorted?
Blank lines are automatically removed. Only lines with content are included in the sorting results.
Q: What happens if numbers and text are mixed?
In numerical sort mode, lines that can be converted to numbers are sorted numerically, and 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 tool 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?
- Sensitivity OFF: All text is converted to lowercase for comparison
- Sensitivity ON: Compared as is (typically uppercase comes before lowercase)
Browser Compatibility
This tool works normally in the following browsers:
- Chrome (all versions)
- Firefox (all versions)
- Safari 10+
- Edge (all versions)
- Opera (all versions)
Related Tools
- Duplicate Remover - Remove duplicate lines
- Text Comparison - Compare two texts
- Character Counter - Check text statistics
Practical Tips
1. Remove Duplicates Then Sort
To remove duplicates and then sort:
- Check "Sort Output" in Duplicate Remover
- Or remove duplicates first then use this tool
2. Sorting Large Datasets
When sorting a specific column from Excel or CSV files:
- Copy the column from Excel
- Paste into this tool
- Copy again after sorting
3. Version Number Sorting
Use numerical sort mode when sorting version numbers:
v1.0.0
v1.10.0
v1.2.0
v2.0.0
Privacy Protection
This tool operates completely client-side. Your input data is not transmitted to any server and is processed only in your browser.