Text Sorter & Deduplicator
Clean up a list in one place: sort lines alphabetically, numerically, by length or natural order, remove duplicates, trim, reverse, shuffle, change case, and number lines.
Interactive Client Prototype Sandbox
Disclaimer: This free tool is provided “as is,” without warranties of any kind, and is for general informational purposes only — not professional, legal, financial, medical, tax, or engineering advice. Results may contain errors; verify anything important independently and use at your own risk. We accept no liability for any loss or damage arising from its use. See our Terms of Use for details.
Step-by-Step Guide
Paste your lines of text (one item per line) into the input area. Select a sort mode: A→Z (alphabetical ascending), Z→A (descending), Numeric (by numeric value, so 2 < 10 < 20 instead of '10' < '2' < '20'), by Length (shorter lines first), Natural (handles mixed alphanumeric strings like a1, a2, a10 correctly), or Random shuffle. Then toggle optional operations that are applied after sorting: Remove Duplicates (case-insensitive), Trim Whitespace (strips leading and trailing spaces from each line), Remove Blank Lines, Change Case (UPPER/lower/Title), Number Lines (prepends 1., 2., 3....).
The output updates live as you change settings, showing the new line count below. Click Copy when done.
Input list: 'banana', 'Apple', 'apple', ' cherry ', '', 'fig': with A→Z sort + Remove Duplicates + Trim Whitespace + Remove Blank Lines → output: 'Apple', 'banana', 'cherry', 'fig' (4 lines, deduplicated case-insensitively, trimmed, blank removed). Natural sort on file names 'file10', 'file2', 'file1' → 'file1', 'file2', 'file10' (correct order, unlike alphabetical which would give 'file1', 'file10', 'file2').
Who it's for
Data wranglers, writers, marketers, and developers tidying lists.
Core Features
- Sort A→Z, Z→A, numeric, by length, or natural order (a1, a2, a10).
- Remove duplicate lines, trim whitespace, and drop blank lines.
- Reverse, shuffle, change case, and number lines.
- Combinable operations with live before/after line counts.
🛡️ No tracking — your inputs, keys, and details never leave this client sandbox.
What is the difference between alphabetical sort and natural sort?
Alphabetical sort compares strings character by character using ASCII values, which means '10' comes before '2' because '1' has a lower ASCII value than '2'. Natural sort (sometimes called 'human sort' or 'natsort') detects embedded numbers and compares them numerically: 'file2' < 'file10' < 'file20'. Natural sort is essential for file names, version numbers, and any list that mixes text and numbers.
How does numeric sort work with negative numbers and decimals?
Numeric sort extracts the leading number from each line (or treats the whole line as a number) and sorts by numeric value. Negative numbers and decimals are handled correctly: -5 < 0 < 3.14 < 10. Lines that do not start with a number are treated as zero or sorted to the end depending on the implementation. Use this mode when your list is a column of numbers and alphabetical order would scramble them.
Does Remove Duplicates keep the first or last occurrence?
Remove Duplicates keeps the first occurrence of each unique line and discards subsequent duplicates. Comparison is case-insensitive, so 'Apple' and 'apple' are considered duplicates and only the first one (in the sorted or original order) is kept.
Can I combine multiple operations?
Yes. Operations are applied in order after the sort: trim whitespace first, then remove blanks, then deduplicate, then change case, then number lines. This means you can, for example, sort alphabetically and remove duplicates in one step. Experiment with the order of toggles — the live preview shows the result immediately so you can see whether the combination produces what you expect.
Alphabetical sort vs. natural sort: two algorithms that look identical until they don't
Both alphabetical sort and natural sort take a list of strings and return them in order. On a list of first names or countries they produce identical results. But put a list of file names or version numbers through each one and you instantly see why they are different algorithms solving different problems — and why choosing the wrong one causes real headaches.
What alphabetical sort actually does
Alphabetical (lexicographic) sort compares strings character by character using character codes. The digit '1' has a lower code than '2', so 'file10' sorts before 'file2' — because at position five, '1' < '2'. This is correct behavior for the algorithm; it just does not match human intuition. A sorted list of software versions using alphabetical order might read: 'v1.0', 'v1.10', 'v1.2', 'v1.9', 'v2.0' — which looks wrong to any person reading it. The same problem appears in spreadsheet exports, log file names, product SKUs, and chapter lists.
What natural sort does differently
Natural sort (sometimes called "human sort" or "natsort") detects runs of digit characters within a string and compares those runs by numeric value rather than character code. The algorithm splits each string into alternating text segments and number segments, then compares corresponding segments: text segments alphabetically, number segments numerically. For 'file2' vs. 'file10', it compares the number segments '2' and '10' numerically — so 'file2' correctly sorts before 'file10'. The result matches what a human would produce by hand.
When each is the right choice
Alphabetical sort is the right choice for purely alphabetic data — names, countries, dictionary words — where numbers do not appear or numeric ordering is irrelevant. It is faster and simpler. Natural sort is essential for file names, version strings, chapter headings, product codes, and any list that mixes letters and numbers where numeric ordering matters. The wrong choice does not cause a crash; it produces a sorted list that looks subtly wrong, which is often worse because it is easy to miss.