How the Sort Lines Tool Works
AnyTool Sort Lines splits the input on newlines (handling both LF and CRLF) and reorders the lines entirely in the browser. Alphabetical and natural sorting use Intl.Collator — natural mode enables numeric collation so embedded numbers compare as values (file2 before file10). Numeric mode sorts by the first signed number parsed from each line, length mode by character count, and column mode by a delimited field. A stable, index-based sort preserves the original order of equal lines.
- Lines split on LF or CRLF; the original newline style is preserved on output
- Alphabetical and natural sort use Intl.Collator with optional locale and case folding
- Natural sort uses numeric collation so file2 sorts before file10
- Numeric sort reads the first signed number in each line; non-numbers sort last
- Column sort splits on a chosen delimiter and sorts by a 1-based index
- The sort is stable — equal lines keep their original relative order
