Clean Text
Strip doubled spaces, stray line breaks and invisible characters from text copied out of a PDF, Word or a web page. Runs entirely in your browser.
Try another tool
Picked to go with this onePaste messy text and get clean text back. This strips the things that ride along invisibly when you copy out of a PDF, a Word document, a chat window or a web page: doubled spaces, stray line breaks mid-sentence, control characters and zero-width characters that make a string fail a comparison for no visible reason. Each fix is a separate switch, so you can collapse spacing without joining paragraphs, or strip invisible characters without touching anything else. It all runs in your browser — the text never leaves your device, which matters when what you are cleaning is a contract or a draft you have not published yet.
How to use this tool
- 01Paste your textAnything from a single line to a long document. Nothing is uploaded.
- 02Turn on the fixes you wantStart with collapse spaces and trim each line. Reach for remove all line breaks only when you actually want one continuous paragraph.
- 03Copy the result, or replace the originalReplace the original text with the result if you want to keep cleaning in passes.
When is this useful?
- Text copied out of a PDFPDFs break lines wherever the column ended, so sentences arrive chopped. Removing line breaks and collapsing spaces puts them back together.
- A string that will not matchA trailing space or a zero-width character is invisible but breaks comparisons, lookups and imports. Removing invisible characters usually fixes it.
- Preparing content for a CMSPasting from a word processor carries formatting artefacts into the editor. Cleaning first keeps the published page tidy.
Examples
- Doubled spacing"Hello World" with four spaces becomes "Hello World" once you collapse repeated spaces. Trimming each line also removes the two spaces hiding at the start.
- A paragraph broken across linesFour blank lines between paragraphs collapse to one. If the sentences themselves were split mid-thought, remove all line breaks joins them into a single flowing paragraph.
Tips for a better result
- Removing line breaks is the destructive oneIt joins everything into one paragraph, so paragraph boundaries are gone. Use it last, and check the result before replacing your original.
- Invisible characters are the usual culpritIf text looks identical but behaves differently, it is almost always a zero-width or control character that came along for the ride.
What actually gets removed
Collapsing repeated spaces turns any run of spaces or tabs into a single space. Collapsing blank lines turns any run of empty lines into one, which keeps paragraph structure while removing the gaps. Trimming each line removes leading and trailing whitespace from every line independently, while trimming the start and end only touches the very beginning and very end of the whole text. Removing invisible characters targets control characters and zero-width characters — the ones that occupy no visual space but are genuinely present in the string, and which break string comparison, CSV imports and search. Each is a separate switch because they are genuinely different operations, and combining them into one "clean" button would remove things you wanted to keep.
Why text from PDFs arrives broken
A PDF does not store paragraphs. It stores glyphs at coordinates, and a line break in the extracted text usually reflects where the visual column ended rather than where a sentence did. That is why pasted PDF text has sentences chopped at odd points and why simply removing every line break often restores it. The same applies to text copied from a narrow email client or a code editor with soft wrapping turned into hard wrapping. If your text came from a two-column layout, expect to do some manual repair afterwards: no automatic tool can reliably tell which fragment belongs to which column.
Everything stays on your device
The cleaning runs in your browser with no upload and no server round trip. There is no request carrying your text anywhere, which is the reason this is safe to use on a draft contract, an unpublished manuscript or notes containing personal details. Closing the tab discards everything.
Frequently asked questions
What are invisible characters?
Control characters and zero-width characters that take up no visual space but are really in the text. They commonly arrive from PDFs, web pages and copy-paste between applications, and they cause strings to fail comparisons that should obviously match.
Will this change my line breaks?
Only if you ask it to. Collapsing blank lines keeps single breaks and removes extra ones. Removing all line breaks joins the whole text into one paragraph and is the one option that discards structure.
Is my text uploaded anywhere?
No. Everything happens in your browser, so the text never leaves your device.
Can I run several passes?
Yes. Replace the original text with the result and clean again with different options. That is often easier than trying to pick the right combination in one go.

