About the Text Cleaner
Text copied from PDFs, emails, chats and web pages often brings hidden problems: double spaces, line breaks in the middle of sentences, non-breaking spaces, tabs and curly quotes that break code or forms. This text cleaner lets you remove extra spaces and any of these other problems in a single pass, choosing exactly which fixes to apply, and it reports how many characters were changed. Clean text is easier to count, search, paste into forms and publish. It works just as well on long documents. For PDF text with broken lines, the Remove Line Breaks tool is more targeted, and the Case Converter fixes capitalisation.
Every rule has its own switch, so you decide exactly what changes. Runs of spaces can be squeezed down to one. Spaces at either end of each line can be trimmed. Empty lines can go. Hard breaks can be removed so separate lines flow back into one paragraph. Curly quotes and long dashes can be swapped for their plain ASCII versions, and anything outside the ordinary printable set can be stripped, including the invisible zero-width marks that hitch a ride from web pages.
The usual fixes start out ticked, so for a typical messy paste you only need to press Clean text. A counter then shows how many characters were changed, which is a quick check that the clean did what you expected.
There is also a stricter option that removes all punctuation and symbols, useful when preparing words for counting or analysis. Leave it off for normal writing, and leave the strict character filter off for any language other than English, because it treats accented and non-Latin letters as unwanted.
Cleaning takes place in your browser, which means contracts, client documents and private notes can be tidied here without being uploaded.
How to use the Text Cleaner
- Paste the messy textAdd whatever you copied from a PDF, an email or a web page.
- Pick the fixesTick only the rules you need; the usual ones start out selected.
- Press Clean textThe tidied version appears below with a count of characters changed.
- Take the clean copyUse the copy button or download the result as a .txt file.
Text Cleaner features
- Repeated spaces and tabs squeezed to one
- Spaces trimmed from both ends of each line
- Empty lines deleted
- Hard line breaks removed so paragraphs rejoin
- Curly quotes and long dashes turned into plain ASCII
- Invisible and zero-width characters stripped
- Optional removal of every punctuation mark and symbol
- Count of characters removed
Common uses
- Tidying text copied out of a PDF before editing
- Unwrapping a quoted email that has hard line breaks
- Removing curly quotes that break code or CSV files
- Normalising user submissions before they are published
- Clearing hidden characters that make database imports fail
Cleaning messy text: spaces, line breaks, hidden characters and stray symbols
Text copied from PDFs, websites, emails and spreadsheets is often messier than it looks: double spaces, broken lines, invisible characters, curly quotes and stray symbols. These cause odd formatting, failed searches, wrong word counts and errors when importing data. Cleaning text removes the mess in one pass. This guide explains the common problems and how each fix works.
Extra spaces
Double spaces after full stops, spaces at the start or end of lines and runs of spaces used for alignment all creep into text. Collapsing multiple spaces into one and trimming line ends gives clean, consistent text. In data, trailing spaces are a classic cause of mismatches: "London" and "London " look identical but are not equal to a computer.
Empty lines
Text from emails and web pages often contains blank lines between every paragraph, or several blank lines in a row. Removing all empty lines turns a padded list into a compact one; reducing them to single blank lines keeps paragraphs separate while removing excess.
Unwanted line breaks
PDFs and emails often break lines at a fixed width, so a paragraph arrives as many short lines. Joining these lines turns them back into flowing paragraphs. When you need to keep paragraph breaks while joining lines inside paragraphs, Remove Line Breaks gives finer control.
Invisible characters
Some characters take up no visible space but still exist in the text:
| Character | Where it comes from | Problem it causes |
|---|---|---|
| Non-breaking space | web pages, word processors | searches and splits fail |
| Zero-width space | websites, chat apps | invisible breaks in words and URLs |
| Tab | spreadsheets, code | uneven spacing |
| Soft hyphen | publishing software | hidden hyphens in words |
Removing or normalising them prevents mysterious bugs, such as a password that will not match or a word that will not search. To inspect exactly which hidden characters are present, Invisible Text Generator reveals them one by one.
Curly quotes and special punctuation
Word processors convert straight quotes into curly ones and hyphens into dashes. That looks good in documents but can break code, CSV files, command lines and some forms. Converting typographic quotes and dashes to plain equivalents makes text safe for technical use.
Special characters and symbols
Some cleanups call for removing everything except letters, numbers and basic punctuation, for example when preparing keywords, tags or file names. Be careful with this option for normal prose, because it removes useful symbols such as currency signs and percentage marks. For punctuation specifically, Remove Punctuation lets you keep apostrophes or hyphens.
A worked example: cleaning text copied from a PDF
A student copies three paragraphs from a PDF journal article into notes. The pasted text has a line break every eight words, double spaces where the original had justified spacing, and a hyphen splitting "infor-mation" across lines. Joining broken lines restores the paragraphs, collapsing spaces fixes the gaps, and a quick search for "- " finds the split words to fix. The notes now read naturally and the word count matches the original paragraph.
Order of operations
When text has many problems, clean in this order: remove invisible characters, normalise quotes and dashes, join broken lines, collapse spaces, then remove empty lines. Doing it in this order prevents leftovers, such as a double space created by joining two lines.
Cleaning data before importing
Before importing a list into a spreadsheet, CRM or email tool, clean it: trim spaces, remove empty lines, normalise quotes and remove invisible characters. Then remove duplicates with Remove Duplicate Lines. Clean data imports first time, without errors or duplicate records.
Line endings: Windows, Mac and Linux
Different systems end lines with different invisible characters. Windows uses a carriage return followed by a line feed, while macOS and Linux use only a line feed. Mixed line endings can make files show extra blank lines, break scripts or confuse comparison tools. Cleaning text in the browser normalises line breaks, so the result behaves consistently when pasted into editors, spreadsheets or code.
Cleaning text for spreadsheets
Spreadsheets are sensitive to stray characters. A leading space stops a number from being recognised as a number, a non-breaking space breaks lookups, and a hidden line break inside a cell splits rows when exporting to CSV. Cleaning a column of text before pasting it into a spreadsheet avoids hours of puzzling over formulas that refuse to match.
Keeping a clean copy
Cleaning can remove things you later need, such as intentional double line breaks between sections or special symbols in names. Keep the original text until you have checked the cleaned version, especially for long documents or important data, and compare them with Text Diff Checker if anything looks different from what you expected.
Cleaning before translating
Machine translation tools work best on clean text. Broken lines can make a translator treat half-sentences as separate sentences, producing odd results. Joining lines and removing stray symbols before translating gives noticeably better output, and the cleaned source is easier to compare with the translation afterwards.
Privacy
All cleaning happens inside your browser. Your text is never uploaded, so documents, notes and data lists stay private.
Further reading: Word Count and Character Limits: A Practical Writer's Guide.
Frequently asked questions
What are zero-width characters?
Characters that take up no space at all, like the zero-width space or a stray byte order mark. Text copied from websites often carries them, and they quietly break searches, comparisons between strings and CSV imports while the text looks perfectly normal.
Will joining lines spoil my layout?
It merges separate lines into flowing paragraphs, which is exactly right for text that an email program wrapped by force. If you are cleaning a list in which every line matters, keep that option turned off.
What happens to curly quotes and dashes?
Typographic quotes and apostrophes are turned into straight ones, and en and em dashes become ordinary hyphens. That matters whenever text is headed for code, configuration files or any system that expects simple keyboard characters.
Will the strict filter remove letters from other languages?
Yes. It keeps only the basic printable ASCII characters, so accented letters disappear along with non-Latin scripts such as Urdu or Arabic. Keep it switched off for any text that is not in plain English.
Is the text uploaded for cleaning?
No. Every rule runs inside your browser, so contracts, drafts and client documents can be cleaned without sending a single character to a server or storing anything afterwards.
What if I clean too much?
Nothing is lost. Your original stays in the input box, so you can untick a rule and press Clean text again for a gentler result, as many times as you need.