Paste a list out of a spreadsheet, an email thread or a shared note and it almost never arrives clean. There are empty lines where someone pressed Enter twice, names with spaces hanging off the end, and the same person listed twice because one copy reads "Ana" and the other reads "ANA". None of it looks like much, until the list feeds a mail merge, an import or a headcount and the mess turns into gaps and double entries.
The fix is a small, well-defined job: remove the blank lines, trim the stray spaces at the ends of lines, and merge the lines that were only pretending to be different. This guide does it with the free Data Deduplicator and Cleaner on Ovatly, which runs in your browser and shows a change log of everything it removed.
Contents
- Quick answer
- Where the mess comes from
- What each cleanup control does
- The spaces this cleanup does not touch
- How to remove blank lines and extra spaces, step by step
- Worked example: five lines in, two lines out
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Open the Data Deduplicator and Cleaner, paste your list, and turn on blank-line handling and trim whitespace. Set case sensitivity to match your intent, choose keep first, run the cleanup, and read the change log: it counts the duplicates removed, the blanks removed and the lines kept. Two honest warnings before you start. Trim only removes spaces at the start and end of a line, never spaces inside it. And matching is exact once your chosen settings have been applied, so lines with typos in them will not merge.
Where the mess comes from
Blank lines creep in whenever text moves between tools. A paragraph break in a document becomes an empty line in a plain list. A spreadsheet column copied into a note picks up trailing spaces from the cells. Two people typing the same list at different times produce different capitalisation, so "Ana" arrives from one source and "ANA" from another.
Each defect is small, but they compound. A trailing space makes two otherwise identical lines compare as different, which is why a list can look deduplicated and still contain the same name twice. Cleaning the blanks and the spaces first is what makes the duplicate check honest: once every line is trimmed down to its real content, the lines that remain different genuinely are different.
What each cleanup control does
The tool offers a handful of controls, and each one answers a specific kind of mess.
Blank-line handling removes lines with nothing on them. It never touches a line that holds content, and the change log counts how many empty lines went.
Trim whitespace strips the spaces at the start and end of every line before anything else happens. This matters twice over: the output looks tidier, and the comparison itself uses the trimmed line, so "Ana " and "Ana" are recognised as the same entry.
Case sensitivity decides whether capitalisation makes lines different. With case-insensitive matching, "Ana", "ANA" and "ana" are one line. With case sensitivity on, they are three different lines and all survive.
Keep first or keep last decides which occurrence of a duplicate survives. Keep first preserves the earliest copy, keep last the most recent.
The change log is the audit trail: input lines, duplicates removed, blanks removed, lines kept. If those numbers do not match what you expected, your settings are wrong, not the tool.
The spaces this cleanup does not touch
Be clear about the boundary: trim works on the edges of a line only. Spaces inside a line are left exactly as they are. A name typed as "Ana Maria" with a double space in the middle keeps its double space, and a line with a stray space before a comma keeps that too.
The same honesty applies to matching. Once trim and case settings have done their work, matching is exact. A line with a typo, an extra word or different punctuation is a different line, and it survives the cleanup. This tool removes blanks, stray edge spaces and true duplicates; it does not guess that two similar lines meant the same thing.
How to remove blank lines and extra spaces, step by step
- Open the Data Deduplicator and Cleaner and paste your list into the input.
- Turn on blank-line handling, so empty lines are removed rather than carried into the output.
- Turn on trim whitespace, so every line is compared and output without its leading and trailing spaces.
- Decide on case sensitivity. Leave matching case-insensitive if capitalisation differences should count as the same line; turn case sensitivity on if "Ana" and "ANA" are genuinely different entries in your data.
- Choose keep first or keep last.
- Run the cleanup, read the change log against what you expected, and copy the cleaned list out. Keep your original pasted somewhere safe until you have checked the result.
Worked example: five lines in, two lines out
Take this short list, copied from two different sources, with a blank line sitting in the middle:
Ana
ben
ANA
Ben
Run it with trim on, case-insensitive matching, blank-line removal on and keep first. The output is:
Ana
ben
Here is what happened, line by line. The blank line was removed by blank-line handling. "ANA" matched "Ana" once case was ignored, so the later copy went. "Ben" matched "ben" the same way. The change log reports the whole story in numbers: 5 input lines, 2 duplicates removed, 1 blank removed, 2 kept. If any of those numbers surprise you, a setting is not what you thought it was.
Limitations and honest tradeoffs
Matching is exact after the normalizations you choose, and nothing more. Near-duplicates, such as the same name with a typo or a middle initial in one copy only, are not merged. That restraint is deliberate: a tool that guessed would eventually merge two different people who happen to look similar.
Spaces inside a line survive, as the section above explains, so internal spacing problems need a manual edit. In CSV mode the comparison is stricter still: the tool compares whole rows, the header row is always kept, and a row that differs in a single cell counts as a different row. Finally, keep first and keep last are position rules, not truth rules. The tool cannot know which copy of a line is the correct one; it only knows which one came first or last.
Common mistakes
- Expecting middle spaces to be fixed. Trim works on line edges only. A double space inside a name survives, by design.
- Leaving case sensitivity on, then wondering why "ANA" survived next to "Ana". With case-sensitive matching those are two different lines, and both are kept.
- Skipping the change log. The counts are the only proof the cleanup did what you asked. Five seconds of reading beats re-checking two hundred lines by eye.
- Cleaning your only copy. Paste the list in, clean it, check the output, and only then replace the original.
- Turning trim off and keeping invisible duplicates. Without trim, "Ana " and "Ana" are different lines, and both survive while looking identical on screen.
FAQs
What counts as a blank line? A line with nothing on it. Turn on blank-line handling and those empty lines are removed from the output, and the change log counts how many went. Lines that hold actual content are never touched by this setting.
What does trim remove, exactly? The spaces at the very start and the very end of each line. Spaces inside a line, between words, are left exactly as they are, so a name like 'Ana Maria' keeps its internal space.
Why did 'Ana ' and 'Ana' merge into one line? Because trim removes the trailing space before matching, the two lines become identical, and the deduplicator keeps one of them. Matching is exact, but it happens after the normalizations you switched on.
Should I keep the first or the last copy of a duplicate? Keep first preserves the earliest occurrence of a repeated line, keep last preserves the most recent one. For a cleanup of blanks and spaces it rarely matters, because the surviving copies are identical once trimmed.
Is my data uploaded to a server? No. The cleanup runs in your browser, and your list never leaves your device.
Conclusion
Clean data is mostly boring data: no empty lines, no invisible spaces, no name appearing twice in different capitalisation. The Data Deduplicator and Cleaner gets a list there in one pass, and its change log lets you verify the result instead of trusting it. When the next job is combining two lists into one, our guide to merging two lists and removing the overlap walks through that method. For more guides in this series, see our Data and JSON Tools guides.
References
- RFC 4180, the common format for CSV files, whose rows and line breaks are the structure this cleanup works on: https://www.rfc-editor.org/rfc/rfc4180