You copy a sentence and paste it, and it arrives with the wrong font, an inherited background colour, spacing that will not go away, and — in a code editor — quotation marks that look right and break everything. The clipboard is doing something more complicated than most people assume, and once you know what, controlling it becomes straightforward.
What is actually happening
The clipboard does not hold one thing. It holds the same content in several formats simultaneously — plain text, HTML, RTF, sometimes an image — and the receiving application silently picks the richest one it understands. Ctrl+Shift+V tells it to take the plain-text version instead.
The clipboard holds several formats at once
When you copy formatted text, the source application writes multiple representations, each tagged with a type. The receiving application enumerates them and takes the most capable one it can handle.
| Format | Contains | Preferred by |
|---|---|---|
text/plain | Characters only | Code editors, terminals, plain fields |
text/html | Markup with inline styles | Browsers, rich editors, CMS platforms |
text/rtf | Rich Text Format | Word processors |
image/png | A bitmap | Image editors, chat apps |
| Application-specific | Native object data | The same application only |
This is why copying a chart from Excel into PowerPoint produces a live editable chart, into Word produces an embedded object, and into a text editor produces tab-separated numbers. One copy operation, several representations, each consumer choosing differently.
Why Word's HTML is enormous
Word does not emit clean markup. It emits a representation designed to round-trip perfectly back into Word, which means carrying its entire formatting model — style definitions, list templates, language attributes, and Office-specific properties for everything it might need to reconstruct.
Six words of content, several kilobytes of markup. The mso- properties are meaningless outside Word. Paste that into a content management system and it goes into your database and eventually into your published page, where it overrides your stylesheet with hardcoded fonts and colours.
⚠️ Why one pasted paragraph looks different from the rest
Those inline styles are far more specific than any stylesheet rule, so they win. The paragraph keeps Calibri 11pt in #1F1F1F while everything around it uses your design's typeface. It also survives theme changes and dark mode, because it was never participating in your styling in the first place.
This is the most common cause of one-paragraph-looks-wrong bugs in CMS-published content, and no amount of editing in the visual editor removes it — the styles have to be stripped from the markup.
Pasting plain across applications
| Application | Shortcut |
|---|---|
| Most Windows and Linux apps | Ctrl + Shift + V |
| Chrome, Firefox, Edge | Ctrl + Shift + V |
| macOS, most apps | Cmd + Shift + V |
| macOS, some apps | Cmd + Opt + Shift + V |
| Microsoft Word | Ctrl + Alt + V → Unformatted Text |
| Google Docs | Ctrl / Cmd + Shift + V |
| Slack | Ctrl / Cmd + Shift + V |
| Terminals | Always plain — no other format is understood |
Word's default paste behaviour can be changed permanently, which is worth doing if you paste from the web often:
The universal fallback
When an application offers no plain-paste option, route the text through something that only understands plain text: Notepad, TextEdit in plain mode, a terminal, or the browser's address bar. Copying out of it gives you a clipboard with nothing but characters.
Smart substitution and code
Word processors and messaging apps rewrite characters as you type, and those rewritten characters travel on the clipboard:
| You typed | What was stored | Effect in code |
|---|---|---|
" U+0022 | " " U+201C U+201D | Syntax error |
' U+0027 | ' ' U+2018 U+2019 | Syntax error |
-- | — em dash | Broken flag or operator |
... | … ellipsis | Broken spread operator |
-> | → arrow | Broken arrow function |
| Space | Non-breaking space | Invisible parse failure |
🚨 The invisible syntax error
A curly quote looks almost identical to a straight one at normal font size. Code copied from a document, a chat message or a slide deck produces SyntaxError: Invalid or unexpected token on a line that appears completely correct, and staring at it does not help.
The non-breaking space is worse still, because it is genuinely invisible. Most editors can be configured to render special characters — turning that on once saves hours later.
Turn the substitution off at the source. In Word it is under AutoCorrect → AutoFormat As You Type; on macOS it is a system-wide setting under Keyboard → Text Input. Anyone who shares code in documents should disable it permanently.
Handling paste in your own application
For a rich editor that should keep some formatting, sanitise with an allowlist — enumerate what is permitted and discard everything else. A blocklist approach fails, because there is always another attribute you did not think of.
Note replaceWith(...el.childNodes) — it removes the disallowed element while keeping its contents, so stripping a <span> does not delete the text inside it. Removing the node outright is a common bug that silently loses content.
🚨 Pasted HTML is untrusted input
Anything on the clipboard could have come from a malicious page, and inserting it into the DOM without sanitising is a cross-site scripting vector. Handling <script> is not sufficient — onerror on an image, javascript: in an href, and <svg> event handlers all execute too.
Use an established library such as DOMPurify rather than writing your own. This is a problem where the edge cases are numerous and the cost of missing one is high.
Application-specific behaviour
| From → To | What happens |
|---|---|
| Excel → Word | Becomes a table; may embed a live link to the workbook |
| Excel → text editor | Tab-separated values, one row per line |
| Web page → Word | Full styling, and often images by reference rather than embedded |
| Word → CMS editor | Style pollution — the classic case |
| Figma → Figma | Native object data with full fidelity |
| Terminal → anywhere | Plain text only |
| PDF → anywhere | Often broken line breaks; ligatures may become odd characters |
PDF is worth expanding on. A PDF has no paragraphs — it has text positioned at coordinates. Copying reconstructs reading order by guesswork, which is why pasted PDF text arrives with a line break at the end of every visual line rather than every paragraph, and why multi-column layouts interleave. Ligatures add another problem: a single fi glyph may paste as one character rather than fi, which then fails a search for "file".
NFKC normalisation is the useful part there — it decomposes ligatures and other compatibility characters into their plain equivalents, which makes the text searchable again.
Summary
- The clipboard holds several formats at once. The receiver picks the richest it understands.
- Ctrl+Shift+V requests the plain-text version that is already there.
- Word's HTML carries its entire formatting model — kilobytes of
mso-rules per paragraph. - Inline styles beat your stylesheet, which is why one pasted paragraph looks wrong forever.
- Smart quotes and non-breaking spaces travel with the text and break code invisibly.
- Route through a plain-text app when there is no paste-plain option.
- Sanitise pasted HTML with an allowlist, and use DOMPurify rather than rolling your own.
- PDF text needs repair — line breaks and ligatures both need normalising.
Frequently Asked Questions
How do I paste without formatting?
Ctrl+Shift+V on Windows and Linux, Cmd+Shift+V or Cmd+Option+Shift+V on macOS depending on the application. This asks the receiving app to use the plain-text version already present in the clipboard rather than the rich version. Some apps implement it as Paste Special instead.
Why does pasting from Word add so much hidden code?
Word writes an HTML representation of the clipboard content that includes its full style definitions, list numbering, language attributes and Office-specific properties. A single formatted paragraph can produce several kilobytes of markup, most of it mso- prefixed rules that mean nothing outside Word.
Why does my text keep the old font after pasting?
Because the clipboard's rich format carries explicit font, size and colour declarations, and the receiving application applies them rather than its own styles. Pasting as plain text discards those declarations and lets the destination's formatting apply.
Why do quotes turn into curly quotes when pasted into code?
Word processors and messaging apps apply smart substitution as you type, converting straight quotes to typographic ones and hyphens to dashes. Those characters travel with the text on the clipboard, and a code editor sees them as ordinary Unicode symbols — which is why the code looks correct and refuses to run.
Can I make my web app always receive clean text?
Yes. Intercept the paste event, read the text/plain flavour from the clipboard data, and insert that instead of letting the browser handle it. For a rich editor, sanitise the HTML through an allowlist of tags and attributes rather than trying to strip the unwanted ones.