HACKER Q&A
📣 taubek

How does copy/paste work on Windows?


Can I somehow see the exact content of clipboard in Windows? What puzzles me if I copy code from VSC or text from Word if I paste it into notepad I get text only.

But if I paste it to some HTML editor/component/blog I get the formatting.

How is this formatting stored in clipboard?


  👤 jaclaz Accepted Answer ✓
What is stored in the clipboard depends essentially from the source it is copied from, and what is pasted to another program depends on what the target program is prepared to receive.

In the case of text, very often what is copied is plain text + formatted text like HTML or RTF (i.e. there are two - or more - "items" loaded to the clipboard) and when you paste, what is pasted is the default (or the only) kind of text that the program accepts (notepad accepts only plain text, other programs might allow you to choose between paste or paste text only).

Check:

https://freeclipboardviewer.com/windowsclipboard/

Try:

https://www.nirsoft.net/utils/inside_clipboard.html


👤 Shadowed_
When you copy something, application can put data in multiple formats on clipboard. When you paste, application may or may not recognize some of those formats and will choose which one (if any) to use. In your example MS Word will store at least two formats. One is plain text and one is formatted. Which one is used depends on destination application (where you paste).

Others already recommended software that will let you see what's currently on the clipboard. In the past, Windows had application for that.


👤 PaulHoule
There are programs that can show the clipboard contents

https://www.techspot.com/guides/1665-windows-clipboard-manag...

Here are some official docs

https://learn.microsoft.com/en-us/windows/win32/dataxchg/cli...