Sort Lines

Sort text lines alphabetically, numerically, by length, or randomly — ascending or descending order.

About Sort Lines

Sorting lines of text is a fundamental text processing operation used in data preparation, code organization, and list management. This tool sorts text line by line with multiple sorting modes: alphabetical (lexicographic), numerical (treating lines as numbers), by line length, random shuffle, and simple reversal of current order.

The numerical sort is particularly useful for sorting numbered lists, IP addresses, version numbers, and log files with numeric prefixes. It uses a natural sort algorithm that treats numeric sequences within lines as numbers rather than text, so "item10" sorts after "item9" instead of between "item1" and "item2".

Combined with the "Remove duplicates" option, sort lines is a powerful deduplication and normalization tool for building clean vocabulary lists, sorted configuration entries, and unique identifier sets.

FAQ

What is natural sort order?
Natural sort treats embedded numbers as numbers, not strings. So "item2", "item10", "item20" sort correctly as 2→10→20 instead of lexicographically as item10→item2→item20. This tool uses natural sort for both alphabetical and numerical modes.
Can I sort CSV columns?
This tool sorts complete lines. For CSV column sorting, you'd need a dedicated CSV tool. However, if each CSV row is on a single line and you want to sort by the entire row content, this tool works well.