How to clean text copied from a PDF on a Mac
You can do this with Note My. It shows you the invisible characters a page-layout document brings across with the words, and removes them without rewriting anything you actually typed.
You copied a paragraph out of a PDF. On screen it looks almost right. Then you search for a phrase and nothing matches, a word has a hyphen in the middle of it for no reason, and a sentence breaks in a place you did not put a break. The characters causing that are real, they are in your text, and most of them are invisible.
This guide covers what a page-layout document actually puts on the clipboard, how to see it in Note My, and how to remove it — including the part most people get wrong, which is knowing which of it is safe to remove automatically and which is not.
What a copy out of a PDF actually puts on the clipboard
A PDF has no paragraphs. It has glyphs at coordinates. When you select a block and copy it, the viewer reconstructs text from that layout, and the reconstruction carries the typesetting with it. Six things arrive that you did not type.
| What arrives | Code point | What it does to you |
|---|---|---|
| Soft hyphens | U+00AD | Invisible unless the line breaks there. Splits words for search and spell-check. |
| Line separator | U+2028 | Breaks a line without starting a paragraph. Not a newline your tools recognise. |
| Paragraph separator | U+2029 | The same problem, one level up. |
| Non-breaking space | U+00A0 | Looks exactly like a space. Is not one, so a search for the phrase fails. |
| Narrow no-break space, ideographic space, and the U+2000–200A family | U+202F, U+3000, U+2000–200A, U+205F | Typesetter's spacing, kept as characters. |
| Smart quotes, dashes and ellipsis | U+2018–201F, U+2013, U+2014, U+2026 | Fine in prose. Wrong in code, in a config file, or in anything that reads the text literally. |
Zero-width characters, bidi controls and control characters come across too, particularly from a PDF generated out of a word processor. Note My recognises 21 categories of stray character and grades them by how safe each one is to remove: always safe, context-dependent, and reported for information only.
Paste always arrives as plain text
One thing you do not have to deal with: formatting. Paste in Note My always inserts plain text, never styled text. Fonts, sizes, colours and paragraph styles from the source document do not come across. There is no "paste without formatting" step to remember, because there is no other kind of paste.
What survives is the characters themselves, which is exactly the problem this guide is about. Size is not a barrier: our large-file engine takes a whole chapter in one paste without the window seizing up, and a very long one shows a progress sheet you can cancel. All of it happens on your Mac — nothing is uploaded, there is no account, and the document never leaves the machine.
There is a "Clean pasted text" option that puts our cleanup rules to work on anything you paste, so the text lands already tidied. It is off by default, in Settings ▸ Text Cleanup. Leave it off until you have seen what your source actually produces — once you know, turning it on saves you a step on every paste from the same document.
See what came across
Before removing anything, look at it. Two views are worth turning on.
The status-bar pill keeps a running count for you from our hidden-character scanner. It reads Clean in green when there is nothing to report, "N hidden" in orange when there is, and "N hidden · D risky" in red when some of it is the kind that can change meaning. Click it and the popover offers Show in Text, Remove Invisible Character(s), Review All… and Go to Next — the last only while there are findings to step through.
The pill is deliberately cautious. Its one-click removal covers only the characters that are wrong wherever they appear — the ones that cannot alter a word, its punctuation or the way a line reads. Anything that calls for a judgement is left to the review sheet, where you see it listed before you decide.
Turning on Show Invisibles from the toolbar draws spaces as ·, tabs as → and a non-breaking space as a ring. It changes what you see, not what is in the file. The markers that flag stray characters are separate: soft hyphens, zero-width characters and the U+2028/U+2029 separators are drawn as slugs, the space family gets a background tint, and smart punctuation is underlined.
When you would rather walk the document than read a list, Find Next Hidden Character and Find Previous Hidden Character in the toolbar's Clean menu carry the insertion point from one finding to the next, and Go to Next in the pill popover does the same from wherever you already are. On a long paste that is often the fastest way to get a feel for what the source hands you before you change a single character.
Clean the paste
-
Select the block you just pasted
Cleaning the whole document is rarely what you want when the rest of the file is yours. Select the pasted paragraphs first. Every tool below can work on a selection.
-
Try the one-click pass first
Choose Clean ▸ Clean AI Copy/Paste Markers. With a selection active it is also in the editor's right-click menu, where it reads "…in Selection". It applies the moment you choose it. It removes only artefacts that cannot change visible rendering, wording, tone, punctuation, indentation or emoji structure; anything that needs judgement is counted and reported, not applied.
You get one of a short set of toasts: "No hidden copy/paste markers found.", "Some advanced Unicode markers were found but left unchanged for safety.", "Cleaned N hidden marker(s). Your text was not rewritten.", or "Cleaned N safe marker(s). R risky marker(s) left unchanged." Either of the last two mentioning something left alone is your cue to open the review sheet.
-
Open the review sheet for everything else
Choose Clean ▸ Clean Invisible / Special Characters…. Set the scope segment to Selection, pick a preset, and press Scan. Line numbers in the results are document-absolute even in Selection scope, so they match what the ruler shows.
-
Read the two tables before you apply
The left table lists all 21 categories with a checkbox, a severity chip and a count. The right table lists every finding as Line:Col · Code Point · Category · Action · Risk. Double-click one to reveal it in the editor.
-
Apply
Press Apply (N). It acts on every finding whose category is ticked and that the preset is willing to change; rows listed for information only stay where they are. The results refresh afterwards. The button carries the number with it, so you can see the size of the pass before you commit to it, and one ⌘Z reverses the whole pass, listed in the Edit menu as "Clean Invisible Characters".
Which preset to use
Four presets ship, and the difference between them matters more for PDF text than for anything else.
| Preset | Categories | Good for a PDF paste? |
|---|---|---|
| Safe | 7 — zero-width, bidi controls, soft hyphens, control characters, line separator, paragraph separator, variation selectors | The minimum. Fixes broken words and stray breaks, leaves every space alone. |
| Code-safe (default) | 16 — Safe, plus the whole space family, smart quotes, smart dashes, ellipsis, trailing whitespace and lone CR | Yes. This is the one to start with. |
| Prose | 6 — zero-width, bidi controls, soft hyphens, control characters, variation selectors, trailing whitespace | Narrower than it sounds. It concentrates on soft hyphens and zero-width characters, and leaves the no-break spaces and the separators as the typesetter set them. |
| Aggressive | All 21, and the only preset that actually converts typeset punctuation | Only when you want straight quotes and plain dashes. |
The counter-intuitive part: for prose out of a PDF, reach for Code-safe rather than Prose. Prose is built for text you are treating as writing, so it leaves spacing exactly as it found it — and no-break spaces are the single most common thing a PDF hands you. Code-safe, the default, covers more of the problem. Ticking or unticking any category switches the preset pop-up to Custom, which is the honest way to build the set you actually want.
Smart quotes, smart dashes and the ellipsis are context-dependent. Under Safe, Code-safe and Prose they are listed and counted but never changed. Only Aggressive converts them to ", ', - and .... If you enabled the category and nothing happened, that is why.
Repeating the same clean-up
If you do this often from the same source, the regex rule list is the faster route. Open Clean ▸ Edit Removal Rules… — the window is titled "Residual Removal Rules". It ships with 11 built-in rules, including NBSP→Space, Zero-width chars, Soft hyphen, Word joiner, Line/Paragraph separators→Newline, and three rules for RTF debris that a copy out of a word processor can leave behind. Three are disabled by default.
The built-in rules always behave the way this page describes them, so they are safe to lean on: switch off any you do not want, duplicate one as the starting point for a rule of your own, write new ones from scratch, drag to reorder, and export or import the whole set as JSON. An Analyze panel shows per-rule match counts against the current document or selection before you commit to anything. Running the list is Clean ▸ Clean Now: every enabled rule, over the whole document, in a single step the Edit menu lists as "Clean Residuals". Look at the Analyze panel first and you go in knowing exactly what that step will touch, rule by rule; if you change your mind once you have seen the result, one ⌘Z puts the whole pass back.
Troubleshooting
The words are still broken after cleaning
A soft hyphen is U+00AD and it will be removed. A real hyphen followed by a line break — which is what you get when the PDF baked the hyphenation into the text rather than marking it — is two perfectly ordinary characters, so that one is a Find & Replace job and a judgement you get to make yourself. Open the popover from the toolbar, tick Regular Expression, and match the hyphen and the line break together. Our find and replace shows the match count, so read it before you press Replace All: the same pattern will also close up a word that was hyphenated on purpose.
The pill says Clean but I can still see problems
On a very long document, take the review sheet as the authority: open it, press Scan, and our large-file engine works through the whole document however long it is, so the list you get back is the complete one — a green Clean in the pill on a file that size is best read as "not counted yet". You can also have the pill keep its running count on longer documents, in Settings ▸ Text Cleanup. Either way the complete answer is one menu item away, whatever the size of the document.
Some findings are there to be read rather than fixed
Apply changes what the current preset is prepared to change, and two groups in the table are there to be read instead. The first is the context-dependent categories — smart quotes, smart dashes and the ellipsis — under any preset but Aggressive, as above. The second is the rows that inform: homoglyph letters and combining marks are reported for you to weigh up yourself, and the CRLF / mixed line endings and mixed tab/space indent rows are notes about the file in the same way. Non-NFC clusters are the exception among those — each of those findings comes with its own replacement, and Apply will make it. Tick a category the preset can act on and the button lights up with the count. Treat the rest as a short list of what to check by eye, which on text out of a PDF is usually a minute's work.
Apply changed a quote inside a string literal
"Protect authored text" is on by default, and it is what stops a curly quote inside a string literal or a dash inside a comment from being treated as stray punctuation. It applies to the status-bar pill, the hidden-character search in the Clean menu and the markers in our comparison view: with our advanced language identifier behind them, the punctuation you typed on purpose inside strings and comments stays as you wrote it. In the review sheet, the preset is what decides: Safe, Code-safe, Prose and any Custom set built from them list typeset punctuation without converting it, while Aggressive converts it wherever it appears — string literals and comments included. For a code file, stay with Code-safe or a Custom set and read the right-hand table before you apply.
A search misses a phrase that is plainly there
Almost always a no-break space where you expect a space. Scan with Code-safe and look for the Non-breaking space and Narrow no-break space rows, or turn on Show Invisibles and look for the ring.
Checking that an emoji or an accented character came through whole
These are looked after for you. Emoji built from several joined pieces, and accented letters written as a base plus a mark, are treated as whole characters: the invisible joiners holding them together are reported to you but never quietly removed. If a character still looks wrong, undo with ⌘Z and re-run with a narrower Custom set, adding one category back at a time until you find the one responsible.
What to do once the text is clean
A tidy paste is the start of the job rather than the end of it. Everything below happens in the same window, on the text you have just been through.
- Put the lines back together. Turning U+2028 and U+2029 into real newlines gives you breaks your tools recognise; turning a column of wrapped lines back into flowing paragraphs is the next move, and it is the same regular-expression trick as the baked-in hyphens above. In our find and replace, match a line break that is not followed by a blank one and replace it with a single space. The match count tells you how many joins you are about to make, so you can shape the pattern until the number looks right and only then press Replace All.
- Satisfy yourself that only characters moved. Keep the raw paste in one document and the cleaned version in another, then put them side by side in our comparison view. Every difference is marked, which is the quickest way to see for yourself that the wording you care about came through untouched.
- Your words stay your words. Every command described here removes or substitutes characters. None of them change wording, tone or punctuation on their own — the one-click pass says as much in its own toast — so you can run a pass over a document you have already written and edited without wondering what else it touched. Nothing changes until you ask for it.
- Make the next one quicker. If the same kind of source lands on your desk every week, the rules you built for this document are already waiting for the next one: Clean ▸ Clean Now takes a fresh paste through the whole enabled list in a single step, and the set exports as JSON so the same tidy-up travels to another Mac. The "Clean pasted text" option from the note above settles a paste as it lands, once you know what your source produces. The line-joining work repeats too — find and replace is among the things our macro recorder captures, so a pass you have worked out once can be replayed on the file after this one. For a document you assemble from the same skeleton each time, our template library keeps that skeleton ready to open.
- Code out of a documentation PDF. Once the typeset punctuation and the no-break spaces are gone, our syntax engine colours the block properly, our indentation engine puts the leading whitespace back on an even footing, and what was a screenshot-shaped blob of text becomes something you can actually run.
- Send it on. Text out of a PDF usually has somewhere to be — a spreadsheet import, a build script, a form that wants plain ASCII. Our encoding handling looks after the file when you save, so what you cleaned on screen is what lands on disk, and our auto-recovery safety net means an interrupted afternoon does not cost you the work.
Frequently asked questions
Why does a word from a PDF break in the middle when I search for it?
There is a soft hyphen, U+00AD, inside it. Typesetting inserts them so a word can break at the end of a line; they are invisible everywhere else, but a search treats them as a character. Scan with any preset — all four include soft hyphens — and apply.
Can I clean only the text I just pasted?
Yes. Select it, then use the review sheet with its scope set to Selection, or Clean ▸ Clean AI Copy/Paste Markers, which uses the selection when there is one and the whole document when there is not.
Will cleaning turn my curly quotes into straight ones?
Only under the Aggressive preset. Safe, Code-safe and Prose report smart quotes, dashes and the ellipsis without changing them, because in prose they are usually correct.
Does pasting bring formatting across from the source document?
Paste is always plain text. Whatever is on the clipboard, you get the characters and nothing else — no fonts, no sizes, no colours, no paragraph styles — so there is no paste-and-match-style step to remember.
Can I undo a clean-up if it went too far?
Yes. Each pass undoes in one step, and the Edit menu names it for you — "Clean Invisible Characters", "Clean Residuals", or "Remove [N] Invisible Character(s)" from the pill popover — so one ⌘Z puts the text back exactly as it was.
Is any of this sent anywhere to be processed?
Everything on this page happens on your Mac. Nothing is uploaded, there is no account, and the text you paste never leaves the machine.