A KaPaPi tool for Google Docs
CleanPaste
CleanPaste is a Google Docs add-on that cleans up pasted text — the broken line breaks, doubled spaces, surplus blank lines and invisible characters that come with anything copied out of a PDF, a web page or an AI chat — without flattening the formatting you want to keep.
The committee reviewed the proposal at length and agreed to postpone it.
The committee reviewed the proposal at length and agreed to postpone it.
Open Extensions → CleanPaste and choose Clean selection or Clean document. That is the whole product. Ctrl+Z (Cmd+Z) undoes a clean in one step.
What it cleans
Five cleanups, four on by default.
| Cleanup | Default | What it changes |
|---|---|---|
| Spacing | on | Repeated spaces collapse to one; stray tabs become a space; leading indents and trailing spaces go; non-breaking and other exotic spaces become ordinary ones |
| Extra blank lines | on | A run of two or more empty lines collapses to one. A single blank line is never removed |
| Hidden characters | on | Zero-width spaces, word joiners, byte-order marks, soft hyphens and stray control characters |
| Broken line breaks | on | Rejoins lines that a paste cut mid-sentence, leaving real paragraph breaks alone |
| Remove links | off | Keeps the text, clears the link, and clears the blue and the underline it leaves behind |
Clean selection works on whole paragraphs. Selecting half a sentence cleans the paragraph it sits in, because cleaning half a paragraph produces a result nobody could predict.
The careful part
How it decides to join two lines.
This is the part that damages documents when it is done carelessly, and it is the top complaint about the add-ons CleanPaste replaces: “it struggles to distinguish between line breaks and paragraph breaks.”
CleanPaste joins two lines only when all of the following hold:
- the first line is at least 30 characters — a deliberate short line is usually short
- it does not end on
.!?:;,or a closing quote or bracket - it ends on a letter, a digit or a hyphen
- neither line reads as a heading — Title Case, ALL CAPS, or a real Docs heading style
- neither line starts with a bullet or a number
- both are ordinary paragraphs, not list items
A missed join costs you one keypress. A wrong join welds two separate thoughts together and is not obvious until much later. Every rule above is a reason to refuse.
Two consequences worth knowing:
- A line ending in a full stop is never joined, even mid-paragraph. From the characters alone, a sentence that happens to end at the end of a line is indistinguishable from a paragraph that ends there. CleanPaste leaves a break you can delete rather than merging two paragraphs you cannot easily separate.
- A word split across a break keeps its hyphen.
perfor-/mancejoins toperfor-mance, notperformance, because dropping the hyphen would also destroy it inwell-/known.
Verified, not asserted
Your formatting survives.
CleanPaste edits your document in place, character by character. It never reads a paragraph out as plain text and types it back, which is how this kind of add-on usually loses your work.
The following were checked by exporting a real document from Google after a clean and comparing it formatting run by formatting run — not by eye:
| Content | Result |
|---|---|
| Bold, italic, bold + italic | Preserved, at their exact character ranges |
| Hyperlinks | Preserved, unless link removal is switched on |
| Bulleted, numbered and nested lists | Preserved, including list identity and nesting level |
| Headings | Preserved, and never merged into body text |
| Tables | Spacing and hidden characters cleaned in cells; the table’s shape untouched |
| Korean, mixed Korean/English | Cleaned by the same rules; CJK is never mistaken for a heading |
| Emoji, Arabic, Persian, Indic scripts | Preserved — ZWJ and ZWNJ are deliberately not stripped |
| Currency, numbers, URLs, code-like text | Untouched |
Running CleanPaste twice produces no further change — verified in a live document with a byte-identical export.
Permissions
It sees one document. Yours.
| Permission | Why |
|---|---|
documents.currentonly | Read and edit only the document it is open in. Not Drive, not your other documents |
script.container.ui | Draw its menu and its panel inside Google Docs |
CleanPaste makes no network requests of any kind. There is no server, no database, no account, no API key, no analytics and no AI service. Your text is read and edited inside Google’s own Apps Script runtime and goes nowhere else.
Google attaches userinfo.email and userinfo.profile to every
Marketplace listing automatically; CleanPaste’s own code never reads them. Full detail
in the privacy policy.
Known limitations
What it will not do.
- Inside a table cell, only spacing and hidden characters are cleaned. A cell is narrow enough that a deliberate break looks exactly like a wrapped one.
- The last paragraph of a document is never removed or merged away. Apps Script forbids it.
- Two consecutive paragraphs that both end without punctuation are treated as one wrapped paragraph and joined. That is the PDF-paste signature this exists to repair; real prose almost always ends a paragraph with punctuation.
- Leading whitespace is removed — right for pasted prose, wrong for pasted code. Switch Spacing off, or press Ctrl+Z.
- Editor add-ons run on desktop only. Google does not support them in the Docs mobile apps.
CleanPaste is free, with no trial, no upgrade prompt and no paid tier. The source is public at github.com/kapapi-dev/cleanpaste.