How to use Sort Lines
- Paste a newline-separated list or select a local .txt or .csv file.
- Choose sort direction and mode, then set case, locale, trimming, empty-line, and deduplication options.
- Inspect the ordered lines and copy or download the result.
Supported behavior
Sort Lines orders newline-separated values using alphabetical, natural, numeric, length-based, descending, or random modes. Natural order places item2 before item10, while numeric order accepts lines that are complete numbers and sends invalid numeric values to the end. Alphabetical comparisons can be case-sensitive and locale-aware; optional trimming changes the comparison value without necessarily changing displayed content. Empty lines can be placed first or last, duplicates may be removed after ordering, and stable sorting preserves the original order of equal keys. Random shuffle uses cryptographically secure browser randomness when available, so it is intentionally not reproducible. Pasted lists and selected .txt or .csv files stay in your browser and are never uploaded. The tool treats each physical line as one value rather than parsing CSV records, which means embedded quoted newlines are not recognized as part of a cell. Choose natural rather than alphabetical sorting for numbered labels, and numeric mode only when entire lines represent numbers.
- CSV syntax is not parsed; sorting a multi-column CSV line sorts the whole textual record.
- Random shuffle is secure but cannot be recreated from a seed.
Examples
Natural item order
item10
item2
item1
Result: item1 item2 item10
Numeric ascending
10
-2
3.5
unknown
Result: -2 3.5 10 unknown
Common use cases
- Put version-like labels such as item2 and item10 into natural order.
- Rank a column of plain numeric measurements.
- Arrange translation strings by line length for interface review.
Frequently asked questions
Why does natural sort differ from alphabetical sort?
Natural comparison recognizes digit runs, so item2 precedes item10 instead of item10 preceding item2.
What happens to non-numeric lines in numeric mode?
Only complete numeric lines are parsed; invalid values are placed after valid numbers.
Is the sort stable?
A stable option retains source order among lines with equal comparison keys.
How is shuffle randomized?
The browser’s crypto.getRandomValues is used when available rather than Math.random.
Related tools
Last reviewed

