How to Clean Up a Messy List
Trim first — not because of blank lines, but because a deduplicate that runs too early removes almost nothing while looking like it worked.
The ordering mistake that hides its own failure
Paste a list that's been through a spreadsheet, an email and a document, then deduplicate it.
Nothing happens. Or nearly nothing — and the tool reports success.
Because deduplication compares raw strings. apple and apple are two different lines, and on a list that's travelled through three programs, almost every duplicate has picked up different whitespace along the way.
Trim first and the same list collapses properly.
Cleaned — trimmed, blanks gone, deduplicated
The one you probably want. Keeps the original order.
apple banana cherry date
Tidied only — trimmed, blanks gone
Duplicates kept, in case they mean something.
apple banana apple cherry banana date
Cleaned and sorted A-Z
Sorting destroys any order the list had — use only if it had none worth keeping.
apple banana cherry date
Cleaned and numbered
Adds '1. ', '2. ' and so on. Changes the text, so do not re-clean this.
1. apple 2. banana 3. cherry 4. date
Open the Text Cleaner on its own page to bookmark or share it.
The order, and the reason for each step
- Trim each line — first, because the dedupe below needs it
- Remove blank lines
- Deduplicate — must follow the trim
- Sort — optional, and destructive
- Number — last, because it changes the text
The bit that surprised me
I assumed blank-line removal was the reason trimming has to come first — that a line containing three spaces isn't "empty" and would survive.
It doesn't. This tool's blank-line removal tests each line after trimming it internally, so whitespace-only lines are dropped whether or not you trimmed first.
So the usual advice points at the wrong step. It's the deduplicate that needs the trim, and it's the one where getting it wrong is invisible — blank lines you'd notice, a dedupe that silently removed nothing you wouldn't.
Deduplication keeps the first, and keeps your order
zebra, apple, zebra, mango → zebra, apple, mango
The first occurrence survives and the original order is preserved. That's why sorting is a separate output rather than folded into the main clean — sorting destroys whatever order your list had, and quite often that order was the point.
It's case-sensitive, on purpose
Apple and apple both survive.
Collapsing them would be a judgement about your data rather than a cleanup of its formatting — and for names, codes and identifiers it would frequently be the wrong call. If you do want them merged, run the text through the case converter first, then clean it.
What it deliberately won't do
- Collapse multiple spaces inside a line
- Strip punctuation
- Fix capitalisation
Each of those is a decision about content. Two spaces after a full stop is a house style; a run of spaces mid-line might be alignment that matters, or a separator in exported data.
A cleaner that does less is easier to trust than one that quietly rewrites the middle of your lines. This one only touches the ends of lines, and the lines themselves.
The other two outputs
Cleaned and sorted A–Z runs the full clean and then sorts alphabetically, using your browser's locale comparison — which handles accented characters more sensibly than a raw character-code sort, where Ä lands nowhere near A.
Use it only when the list has no order worth keeping. A list of names sorts happily; a list of steps, priorities or anything chronological does not, and sorting is not reversible once you've pasted it somewhere.
Cleaned and numbered prepends 1. , 2. and so on after cleaning. It's the one to reach for when the list is going into a document or a message where the numbering has to survive being pasted as plain text — which is exactly where a word processor's automatic numbering tends not to.
Number last
Numbering prepends 1. , 2. and so on — which changes the text. Every line is now unique, so a second deduplicate would find nothing.
Do it when you're finished with everything else, not before.
Where messy lists come from
Worth knowing, because the source predicts the mess:
- Spreadsheet exports bring trailing separators and inconsistent trailing spaces — the single most common cause of a dedupe finding nothing
- Word processors bring smart quotes, which look identical to straight quotes and are not
- Email clients bring soft line wraps that become real line breaks on paste
- PDFs bring everything at once, plus line breaks in the middle of entries
The first three are handled by trimming and deduplicating. The last one isn't, and no cleaner will fix it — a PDF that broke an entry across two lines needs a human to decide where the entry actually ends.
One habit worth having
Check the line count before and after. A big drop means over-deduplication — usually a sign the list had meaningful repeats you've just lost.
And nothing here is uploaded. Everything runs in your browser, which is worth stating plainly given what actually gets pasted into cleanup tools: email lists, customer names, exported spreadsheets, and occasionally something that shouldn't have left the building at all.
Print the list cleanup reference if you're the person who keeps getting handed a spreadsheet export to sort out.
Free tool
Text CleanerTrim every line, drop the blanks, remove duplicates - all four results at once, in your browser, on lists that have been through three programs.
Open the tool →Enjoyed this? Get the next one.
New articles straight to your inbox. No spam, ever.
Keep reading
How DNS propagation time is estimated
Learn what DNS propagation time really means, how to estimate it from TTL and cache windows, and what the calculator can’t know.
Aug 4, 2026 · 5 min read
How Big Can I Print This Photo?
300 dpi isn't a standard — it's the answer for arm's length. At ten feet, a 24 MP file covers seventeen feet of wall.
Aug 3, 2026 · 4 min read
How Far Should You Sit From Your TV?
Two different questions with two different answers — and at 4K they stopped agreeing. At nine feet you can go from a 69-inch screen to a 138-inch one.
Aug 3, 2026 · 4 min read