Sort Lines
Order any list one item per line: A to Z, Z to A, natural, numeric or by length.
Processed locally in your browser/ Your data stays in your browser.
What is Sort Lines?
Sorting lines is a daily chore for lists of names, imports, CSS classes, file names and log entries. This tool offers eight orders: alphabetical and reverse, natural order (file2 before file10), by the number found in each line (ascending or descending) and by length.
By default the comparison is exact and predictable (code-unit order: capitals before lowercase). Turn on "ignore case" for a friendlier list, or "language-aware order" to use localeCompare so accented letters such as É sit next to E. You can also drop duplicates and empty lines in the same pass.
How does it work?
- Paste your lines, one per line.
- Pick the order: A → Z, Z → A, natural, numeric, or by length.
- Adjust ignore-case, language-aware order, unique and remove-empty, then copy the sorted list.
Common use cases
- Alphabetizing a list of names, tags or imports.
- Sorting file names such as img1.png … img12.png the way a person expects.
- Ranking lines that start with a number, such as "42 errors" or prices.
- Ordering CSS classes or config keys so diffs stay small.
Examples
Try this input in the tool above:
file10.txt file2.txt Banana apple file1.txt cherry Éclair
apple Banana cherry file1.txt file2.txt file10.txt Éclair
Privacy
Sort Lines runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
Numeric order uses the first number found in each line; lines without a number go last. Language-aware order depends on the collation data of your browser.
Frequently asked questions
Why do capital letters come first?
The default compares raw character codes, where all capitals precede lowercase letters. Enable "ignore case" or "language-aware order" for dictionary order.
What is natural sort?
Natural sort compares digit sequences by value, so "file2" comes before "file10" instead of after "file1".
Related tools
Remove Duplicate Lines
Paste a list and keep only unique lines, in the original order or sorted, with a count of what was removed.
Text Tools
Reverse Lines
Flip a list upside down: the last line becomes the first, the second-to-last becomes the second, and so on.
Text Tools
Shuffle Lines
Randomize the order of any list with one click, using a fair shuffle that every arrangement is equally likely to result from.
Text Tools
Remove Empty Lines
Strip blank lines from pasted text in one click, or keep a single blank line between paragraphs.
Text Tools
Trim Lines
Remove the spaces and tabs at the start and end of each line of a list or block of text.
Text Tools
CSV Sorter
Order the rows of a CSV by one column, comparing values as text, natural text, numbers or dates.
JSON & Data
JSON Key Sorter
Reorder the keys of every JSON object alphabetically to get a stable, canonical document.
JSON & Data