About Sort Lines
Sort lines alphabetically (Unicode order or locale-aware), numerically (8 vs 80 vs 800 the right way), by length (shortest to longest), or reverse any of the above. Case-insensitive optional. Useful for cleaning lists, ordering imports, organizing config files.
When sorting matters
Sorting brings order; ordered data dedups, diffs, and grep cleanly. Common cases:
- Order imports — alphabetical by package name
- Sort an export — for stable diff between exports across runs
- Build a sortedset — alphabetical with case-insensitive optional
- Stable test fixtures — sorted input gives predictable test snapshots
Numerical caveat
Most “natural” sort tools handle the 8.txt / 80.txt case via numeric prefix detection. Ours does too. For pure lexicographic sort (which would put 80.txt before 8.txt), pick the Lexicographic mode.
Common workflows
Sort a CSV before diffing. Sort both files, diff line-by-line; ordering noise vanishes.
Order an alphabetical glossary. Paste terms (one per line), sort, paste into your docs.
Reorder import statements. Many editors do this on save; for files outside the editor’s scope (legacy code, generated files), the tool stands in.
Group log lines. Sort first, then dedupe, surfaces clusters.
Frequently asked questions
Locale-aware?
Numerical sort?
How is sort stable?
sort -s at the shell.Strip empty lines?
Performance?
Diff-friendly?
How do I sort lines in VS Code, Vim, or Notepad++?
:sort (add i for case-insensitive, n for numeric, u to dedupe). Notepad++: Edit → Line Operations → Sort Lines Lexicographically. This tool covers all of them plus locale-aware and length sorting when the editor's built-in falls short.Related tools
Last updated: 2026-07-04