Sort Text Lines
Free online text line sorter. Sort lines alphabetically (A→Z or Z→A), remove duplicates, trim whitespace, drop empty lines, ignore case or reverse the order — instantly and privately in your browser, with no upload and no limits.
How to use the Sort Text Lines
- 1Paste or type your list into the input box, one item per line, or upload a .txt file if the list already lives in a file.
- 2Choose a direction: A-Z for ascending alphabetical order, Z-A for descending, or Reverse to flip the current order without alphabetizing.
- 3Switch on the cleanup options you need: Remove duplicates, Trim whitespace, Drop empty lines, and Ignore case for case-insensitive sorting.
- 4Click Sort to process every line in your browser; the reordered result appears instantly in the output panel.
- 5Check the output and the line count to confirm duplicates merged and blank rows disappeared as expected.
- 6Click Copy to send the result to your clipboard, or Download to save it as a plain text file.
About the Sort Text Lines
Sort Text Lines reorders a pasted block of text one line at a time, entirely inside your browser tab. The moment you paste, the tool splits your text on newline characters, treats each line as a separate item, and runs whatever operations you have switched on. Alphabetical sorting (A-Z) uses your browser's built-in locale-aware string comparison, so accented letters like é and ñ and non-Latin scripts fall into a sensible order instead of raw character-code order. Z-A runs the same comparison in reverse, while the Reverse option simply flips your existing line order without re-sorting at all.
Nothing is uploaded. The code that sorts, deduplicates, and trims runs in JavaScript on your own machine, so there is no server, no upload, and no stored copy of what you sorted. That is what makes it safe for email lists, customer names, internal SKUs, or unreleased copy you would not paste into an unfamiliar web app.
The toggles are where the minutes add up. Remove duplicates collapses repeated lines to one, which rescues you after merging two exported lists. Trim whitespace strips leading and trailing spaces and tabs, so " apple" and "apple" stop sorting as if they were different words. Drop empty lines clears the blank rows that copy-pasted data leaves behind. Ignore case sorts "Zebra" and "apple" purely by letter instead of pushing every capitalized word to the top the way case-sensitive order does.
The people who reach for this daily are specific: developers alphabetize import statements, CSS declarations, and environment-variable keys; writers order glossaries and reference lists; marketers dedupe keyword and email exports; teachers arrange class rosters. One habit saves the most frustration: switch on Trim whitespace together with Remove duplicates before you sort, because an invisible trailing space is the single most common reason two identical-looking lines refuse to merge.
When the output looks right, check the line count to confirm the merge, then copy the result to your clipboard or download it as a plain .txt file and drop it straight back into your spreadsheet, editor, or document.
Frequently asked questions
Is my text uploaded anywhere when I sort it?
No. Every step, sorting, deduplication, trimming, and dropping blanks, runs in JavaScript inside your own browser tab. Your text is never sent to or stored on a server, so you can safely sort sensitive lists such as email addresses, customer records, or unreleased content.
Why do capitalized words sort before lowercase ones?
With case-sensitive sorting, uppercase letters rank ahead of lowercase, so 'Zebra' can land before 'apple'. Switch on the Ignore case option to sort purely by letter, so 'Apple', 'banana', and 'Cherry' order naturally no matter how each line is capitalized.
Two lines look identical but they won't merge as duplicates. Why?
Almost always it is invisible whitespace, a trailing space, a tab, or a non-breaking space on one line but not the other. Turn on Trim whitespace alongside Remove duplicates and sort again; trimming normalizes the ends of each line so the genuine duplicates finally collapse into one.
Why does '10' come before '2' in my sorted list?
Lines are compared as text, character by character, not as numeric values, so '1' sorts before '2' and '10' lands ahead of '2'. To force true numeric order, pad the numbers with leading zeros (002, 010) before sorting, or do numeric sorting in a spreadsheet instead.
How many lines can I sort at once?
There is no fixed limit built into the tool; the ceiling is your device's memory, since every line is held in the browser. Tens of thousands of lines sort in a fraction of a second on a typical computer, though a file of several hundred thousand lines may briefly freeze the tab while it processes.
Related tools
Browse all free online tools in Text tools and more.
Frequently asked questions
Is this line sorter free and private?+
Yes. Everything runs locally in your browser — your text is never uploaded, with no limits, sign-up or watermark.
Can I remove duplicate lines while sorting?+
Yes. Toggle 'Remove duplicates' alongside any sort option. Combine it with 'Case-insensitive' to treat differently-cased lines as the same.
Does it keep my original order if I don't sort?+
Yes. Without a sort option, lines stay in their original order; you can still trim whitespace, drop empty lines, dedupe or reverse them.