Sort Lines
Sort text lines A–Z or Z–A.
Example
- In:
- cherry apple banana
- Out:
- apple banana cherry
Paste or type text, then click Sort.
Guide
Introduction
Unsorted lists slow down every task that follows them. Finding a name in 200 volunteer entries takes longer when rows appear in signup order instead of alphabetical order. Comparing two URL lists by eye is harder when one export is sorted and the other is not. Even a short pile of git branch names becomes scannable once arranged A→Z.
Certoflow's Sort Lines tool alphabetizes multiline text in ascending or descending order with one click. Lines stay intact—only their sequence changes. Like other Certoflow text utilities, sorting runs entirely in your browser. Your data is not uploaded for processing, which matters when lists contain internal project names, student rosters, or client identifiers.
What this tool does
Paste text into Input lines, choose a sort order, and click Sort.
| Option | Result |
|---|---|
| A → Z (ascending) | Lines sorted alphabetically from top to bottom |
| Z → A (descending) | Reverse alphabetical order |
The Sorted lines output shows the reordered list. Content within each line is unchanged: punctuation, numbers, and internal spacing remain exactly as typed. Only line order changes.
Example input:
cherry
apple
banana
Ascending output:
apple
banana
cherry
The tool uses locale-aware string comparison (localeCompare), which handles most Latin alphabets sensibly and respects language-specific ordering rules available in your browser's locale settings.
How it works
Certoflow splits input on newline characters into an array of lines. It sorts that array in place using JavaScript's Array.sort with localeCompare:
- Ascending: line A compared to line B in standard dictionary order.
- Descending: comparison arguments swap so larger strings rise to the top.
The sorted array joins back with \n separators. Empty input yields empty output. A single line returns unchanged. Blank lines participate in sorting—often appearing first or last depending on how empty strings compare in your locale.
Processing is synchronous JavaScript in your tab. No network request occurs when you click Sort.
Real-world examples
Class roster alphabetization. A teacher pastes names as students volunteered them. Sort ascending to match gradebook order before printing name tags for lab groups.
URL list for audit. Two hundred marketing landing paths copied from analytics need review. Sort A→Z so /about, /blog, and /contact group predictably when scanning for broken paths.
Dependency inventory. A package.json audit produces a list of outdated npm packages—one per line. Sort descending to surface @-scoped packages together or ascending to walk alphabetically while updating.
Game tournament seeding draft. Player handles pasted from Discord messages get sorted alphabetically as a neutral starting point before applying seed rules.
Config key review. Environment variable names exported from documentation arrive out of order. Sort lines before diffing against .env.example with Text Compare so line numbers align more closely when keys match.
Common mistakes
Expecting numeric sorting by default. Lines starting with numbers sort as strings: "10" appears before "2" because "1" compares before "2" character by character. Pad numbers (01, 02, … 10) or sort in a spreadsheet when numeric order matters.
Assuming case-insensitive order. Banana and banana may sort in separate regions depending on locale rules. Normalize case first with the Case Converter if case should not affect order.
Sorting before deduplicating when you need both. Sort Lines does not remove duplicates. Run Remove Duplicate Lines first if you need a unique sorted set, or sort afterward if duplicate grouping is acceptable.
Losing association with paired data. Sorting names destroys alignment with adjacent columns if you pasted Name, Score pairs as single lines—each line still sorts as a unit, but if names and scores were on alternating lines, sorting breaks the pairing. Keep structured data in CSV tools when columns must stay linked.
Including trailing \r from Windows exports. Carriage returns attach to line content and affect sort order (apple\r vs apple). Clean line endings when order looks wrong.
Sorting prose paragraphs. Sorting essay paragraphs alphabetically destroys narrative structure. This tool targets lists, not document body reordering.
Use cases
Students organize bibliography entries, vocabulary lists, and group member names. Developers sort branch lists, error codes, feature flags, and test case IDs. Administrators alphabetize inventory SKUs, license keys, and directory group members pasted from admin consoles.
Writers sort index terms or glossary entries during book production. Researchers order survey response codes before coding. Gamers sort clan rosters or mod load order lists shared as plain text.
Because sorting is immediate and local, use it as a quick normalization step before diffing, deduplicating, or pasting into spreadsheets—any workflow where predictable order saves time.
FAQ
Does Certoflow upload my text?
No. Sorting happens entirely in your browser.
Does sorting change text inside lines?
No. Only line order changes.
Is sort case-sensitive?
The tool uses localeCompare, which is typically case-sensitive. Exact ordering may vary slightly by browser locale.
How are blank lines handled?
Blank lines are sorted like any other line, usually appearing at the beginning of ascending sorts.
Can I sort descending?
Yes. Choose Z → A (descending) before clicking Sort.
Does it sort by words or by whole lines?
Whole lines. Multi-word lines sort by the full string content.
What about non-English characters?
Locale-aware comparison handles accented letters according to your browser's locale settings.
Can I undo a sort?
Keep the original input in the source field until you copy output, or paste from your undo buffer. The tool does not maintain history.
Frequently Asked Questions
- Does sorting change line content?
- No. Only line order changes; text within each line stays the same.
- Is sort case-sensitive?
- Uses locale-aware String.localeCompare — typically case-sensitive.
Related Tools
Continue with these related utilities.
Remove Duplicate Lines
Delete duplicate lines from text.
Text ToolsReverse Text
Reverse string character order.
Text ToolsWhitespace Remover
Remove extra spaces and blank lines.
Text ToolsWord Counter
Count words, characters, and sentences.
Developer ToolsJSON Formatter & Validator
Format and validate JSON with one click.