Sort lines
Sort text lines by dictionary order, numeric order or length
Put one item on each line and choose a rule for live sorting. Numeric mode needs a valid number on every line; reversal only flips the current order.
Example
Input
10 2 1
Example result
1 2 10
Choose numeric ascending. Lexical ascending would give 1, 10, 2.
Technical details & limits
Lexical ordering uses JavaScript string comparison, not pinyin or natural-number collation. Numeric mode requires complete finite numbers on nonempty lines so abc or 12px are not silently treated as 0 or 12. Length sorting counts UTF-16 units. Duplicate lines are retained.
About this tool
Sort lines lexically, numerically or by length in either direction, or reverse their order. Options cover case sensitivity, trimming and empty-line removal for lists and configuration data.
Use cases
- Sort a list of keys or fields.
- Sort logs by their leading timestamp.
How to use
- Paste the text to sort.
- Pick sort mode and options. The result updates live.
FAQ
- How is “numeric” different from dictionary order?
- Lexical ordering puts 10 before 2. Numeric ordering parses each complete line as a finite number, so 2 comes first; invalid numbers are rejected.
- Why are duplicate lines still present?
- Sorting changes order without deleting entries. Use the duplicate-line tool and choose its case and whitespace rules explicitly.
- How does reversal differ from descending order?
- Reversal flips the existing sequence without comparing values; descending order sorts by the chosen rule.
- Can numeric mode sort version numbers or IP addresses?
- No. Dotted versions and IP addresses are not single finite numbers. Lexical order is not semantic-version or address order either; use domain-specific comparison rules.
Related tools