Sort Lines of Text Online
Paste any list or block of text and re-order it alphabetically, by line length, or in reverse. Works with keyword lists, meeting notes, log lines, CSV rows, and anything else where line order matters. Sort is done in your browser — nothing is sent to a server.
🔒 Your text is processed locally in your browser and never uploaded. We do not upload or store your text.
- 1 Paste your text
- 2 Choose a sort order
- 3 Click Sort Lines and copy the result
What this does
This tool takes each line of your pasted text and reorders it according to the sort mode you choose. All processing happens in your browser — no text leaves your device.
- A → Z sorts lines using the browser's standard alphabetical text comparison.
- Z → A is the same alphabetical sort in descending order.
- Reverse order flips the lines so the last line becomes the first, and the first becomes the last. Useful for reversing the output of another tool or reading a log from newest to oldest.
- Shortest first sorts by character count, shortest line to longest. Lines of equal length are ordered alphabetically as a tie-breaker.
- Longest first does the same in descending order — the longest line appears at the top.
The three options refine the input before sorting. Ignore case makes the A→Z and Z→A comparisons case-insensitive so that "Banana" and "banana" sort together. Trim spaces strips leading and trailing whitespace from each line before sorting and in the output. Remove blank lines discards any line whose content is empty or whitespace-only before the sort runs.
Before and after
Pasted text
strawberry apple mango banana cherry
After sorting A → Z
apple banana cherry mango strawberry
Common uses
Line sorting is useful any time the order of items in a list matters for readability, processing, or comparison:
- Keyword lists. Sort a list of target keywords, tags, or search terms alphabetically before dropping them into a document or spreadsheet.
- Copied lists and notes. Meeting notes, task lists, or bullet points copied from different sources are easier to scan when sorted.
- Log files and event records. Reverse a log to read the most recent entries first, or sort by severity prefix to group related events.
- CSV and TSV rows. Paste a column of values and sort them before re-importing into a spreadsheet or database.
- Name or email lists. Sort a copied list of names or addresses alphabetically before deduplying or sharing.
After sorting, you can remove any repeated lines with the Duplicate Line Remover. If your pasted text has unwanted line breaks from a PDF or email, clean it up first with the Line Break Remover. To see exactly what changed between the original and sorted versions, paste both into the Text Diff Checker. To fix specific words, labels, or placeholders before sorting, use Find and Replace.
Common questions
Does my text get uploaded anywhere?
No. We do not upload or store your text. The sort runs as JavaScript in your browser; nothing is sent to a server and nothing is stored after you close the tab.
How does alphabetical sorting handle uppercase and lowercase?
By default, sorting is case-sensitive, but exact ordering of uppercase, lowercase, numbers, and punctuation can depend on the browser's locale-aware comparison. Turn on Ignore case to group uppercase and lowercase versions of the same word more predictably.
What happens to blank lines?
Blank lines are treated as lines with empty content. By default they are kept and sort before all other lines (an empty string sorts before any letter). Turn on Remove blank lines to discard them before sorting.
Does "Reverse order" sort anything?
No — it only flips the current order of lines. If you paste five lines and click Sort Lines with "Reverse order" selected, the last line moves to the top and the first line moves to the bottom. It does not sort alphabetically or by length.
Does "Shortest first" count characters or words?
Characters. Each line's length in characters (including spaces, if you have not enabled Trim spaces) determines its position. Lines of the same length are ordered alphabetically as a tie-breaker.