Pasted text often carries invisible baggage: non-breaking spaces from PDFs, zero-width characters from web pages, double spaces, and trailing whitespace. This tool normalises all of it to clean, predictable ASCII spacing.
How it works
The cleaner applies a sequence of substitutions:
1. Remove zero-width chars: U+200B, U+200C, U+200D, U+FEFF
2. Map exotic spaces to a plain space:
U+00A0 (NBSP), U+2007, U+202F, U+2009, U+3000 …
3. Replace tabs with a space
4. Collapse runs of spaces to one (optional)
5. Trim leading/trailing whitespace per line (optional)
6. Collapse 3+ blank lines to a single blank line
The result uses only ordinary U+0020 spaces and newlines, so the text becomes consistent and safe to compare or store.
Example and tips
A heading copied from a slide deck that reads Quarterly Report with a hidden non-breaking space and trailing spaces becomes a clean Quarterly Report. If two strings look identical but fail an equality check, run both through here first — an invisible zero-width character is the usual culprit.
Where invisible whitespace comes from
Different sources introduce different kinds of problem whitespace:
- PDFs — text extracted from PDFs often uses U+00A0 (non-breaking space) instead of a regular space, or ligature characters that split awkwardly. Copy-paste from Acrobat Reader is a common source.
- Word processors — Microsoft Word and Google Docs both insert non-breaking spaces when you use a specific keyboard shortcut or their autocorrect rules. Pasting into a plain-text field carries these across invisibly.
- Web pages — HTML non-breaking spaces (
) survive copy-paste as U+00A0. Some rich-text editors insert zero-width joiners (U+200D) around emoji or between styled spans. - Spreadsheet exports — CSV or TSV content can have leading/trailing spaces on every cell, causing JOIN and VLOOKUP failures that are very hard to diagnose visually.
- AI-generated or translated text — some translation pipelines insert U+200B (zero-width space) at potential break points, or preserve the non-breaking spaces of the source document.
When normalised whitespace matters most
Code and configuration
A stray non-breaking space in a YAML file, a .env value, or a JSON string causes parse errors or comparison failures. If a config value “looks right” but the app rejects it, paste it here first.
Databases and search
Two strings that look identical can be stored as different values if one has a trailing space or an NBSP in the middle. SQL equality checks, Elasticsearch term queries, and unique constraints all treat them as distinct — normalising before insert prevents phantom duplicates.
Spreadsheet formulas
Excel =VLOOKUP() and =MATCH() fail silently when one of the compared strings has a leading space. =TRIM() in Excel handles regular spaces only; it leaves U+00A0 intact. Paste the column through this tool to strip everything, then reimport.
Copy editing and publishing
Automated tools that check for double spaces or flag widows/orphans can be confused by non-breaking spaces that are visually indistinguishable from regular ones. Normalising the draft before running the checker avoids false negatives.
Common mistake: TRIM removes the wrong thing
The standard TRIM() function in Excel, SQL, and most programming languages removes only ASCII U+0020 spaces from the start and end. It leaves U+00A0 and zero-width characters completely untouched. If TRIM() appears to have no effect, the whitespace is almost certainly one of these non-ASCII variants — which is exactly what this tool removes.