The clipboard is a pretty amazing concept. It’s one of those things we use daily, take for granted, and rarely even think about …
… except when it doesn’t do what we expect.
Let’s review some of the magic behind the clipboard’s curtain. It’s more complex than you might realize.
Become a Patron of Ask Leo! and go ad-free!
I have to start with the usual caveat: this is not meant to be a detailed treatise on the inner workings of the clipboard. It almost certainly doesn’t work exactly as I outline below. I’m grossly oversimplifying in order to make concepts and behavior clearer for non-programmers.
Conceptually, the clipboard is extremely simple: you copy1 something to it, where it remains until overwritten by another copy-to-clipboard. You can then paste2 it somewhere, which copies what’s in the clipboard to the location you indicate.
It’s a two-step process. First, you identify the item you want to copy — usually via a selection of some sort — and then copy it to the clipboard using a keystroke or mouse sequence.
Then, you identify a new location into which you want to place the copied item, and paste it there, once again using a keystroke or mouse sequence.
In the example above, I’ve copy/pasted some text3 from one document to another via the clipboard. When done, the text I’ve selected exists in three places:
- The original location I copied from.
- The clipboard.
- The new location I pasted into.
The text will remain in the clipboard until the next time I copy something to it, because the clipboard can hold only one thing at a time.4
Conceptually, that’s how the clipboard works, and in some cases, it actually does work that way.
But in many cases, it doesn’t.
If you’ve ever copy/pasted from a word-processing program like Microsoft Word into a plain-text-editing program like Notepad, you may have noticed that all the formatting is lost. Notepad doesn’t do formatting; it’s text-only. Copy/pasting from Word to Notepad is, in fact, a convenient way to get only the text.
But as you might imagine, under the hood things are more complex. Word, for example, doesn’t know where the data will be pasted, or what the capabilities of the receiving program might be. Ideally, it makes the highest fidelity of whatever has been copied available, but someone has to handle the conversion from one format (fancy and formatted) to the other (plain text).
There are two catches:
- We can’t assume that the clipboard understands what is being copied.
- We can’t assume that the destination application knows what to do with the way the information is stored. (Though it would be nice if it did.)
The result is that when you copy something to the clipboard, the application you’re copying from provides a little more information than just the data to be copied; it includes the formats it can make that data available in.
Depending on the sophistication of the program you’re copying from, it may offer many different formats — as Word might — or it might offer only one. But that information, along with the data to be copied (in most cases; more on that in a moment), is given to the clipboard when you copy something.
Paste has a similar complication in that the program you’re pasting into asks the clipboard for the data in a priority-ordered list of preferred formats.
When you paste, the clipboard takes the highest-priority-requested format that was made available by the original copy, and provides that to application into which the data is to be pasted.
In our example, the “list” of preferred formats was only one item long, so the clipboard took the plain text of the copied data provided by Word and gave it to Notepad.
The clipboard doesn’t really care or even understand what’s being copied or pasted; it just acts as an intermediary between the program from which data is copied and the program into which the data is pasted.
Those programs, on the other hand, care a lot. For example, we can use copy/paste to move files around in Windows File Explorer, but pasting a file into Notepad doesn’t make sense.
You can’t paste just anything anywhere — one of the formats offered by the source of whatever it is you want to copy must be a form that the destination understands. If that can’t happen, you can’t paste. In most cases, that manifests as a greyed-out “Paste” item in the destination application.
When things get big, really big
There’s no conceptual limit as to how big something can be for copy/paste. There are practical limits, and they come from not-so-obvious places.
The clipboard itself can only hold so much, but that doesn’t prevent it from brokering larger items. When a large item is copied to the clipboard, it can elect to keep only the available format information and not the data. Instead, the application in which the copy happened must hold on to the data until the someone requests it (or the clipboard is replaced or emptied). When a paste occurs, the information is transferred from application to application — the clipboard acts only as an intermediary to facilitate the exchange.
- The application in which you hit “copy” tells the clipboard that the data is available, how large it is, and what formats are available.
- The application into which you “paste” tells the clipboard that it wants the data, and in which format.
- The clipboard essentially says, “You guys figure it out”, and the data is transferred directly from one application to the other.
This technique results in behavior that might confuse you. For example, what happens when you close the first application before you paste into the second?
Closing the copy source before the paste
When the data is copied to the clipboard, as in our earlier example of a small copy/paste, it doesn’t matter if the source application is closed before you paste. Everything necessary was placed into the clipboard and remains available for a paste operation.
In the example of a large copy, though, where the clipboard doesn’t hold the actual data, there are two options when the source application goes away:
- The clipboard can be emptied. The source application isn’t available to provide the copied data, so there’s nothing to paste.
- The data can be written to disk for the clipboard to access later when a paste is requested.
I’ve seen both; it varies from application to application. When you close an application that has made something large available to the clipboard, it may:
- Write it to disk without asking
- Offer to write to disk (as Word is doing in the example above)
- Offer to abort the exit so the program keeps running to provide the information via the clipboard
- Empty the clipboard without asking
The clipboard’s about more than the clipboard
Needless to say, I’ve only scratched the surface of the clipboard’s capabilities.
Perhaps most important is to realize that the clipboard’s functionality — beyond its role as intermediary — is provided by the applications from which you can copy and into which you can paste. They control what can be copied, where it can be pasted, and what results or transformations — like fancy text to plain text — are available.
Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.
I'll see you there!
Download (right-click, Save-As) (Duration: 8:27 — 3.9MB)
Subscribe: Apple Podcasts | RSS
18 comments on “Why Do Things Disappear from the Clipboard When I Close a Program?”
I haven’t seen that “There is a large amount of information on the Clipboard. Do you want to be able to paste this information into another program later?” type of message for a long time in MS Office. I think it may be due to the fact that computers have so much more RAM that the leftover stuff in the clipboard isn’t as significant in relation to RAM size as before. I also remember when MS Office programs would empty the clipboard when opening.
I am NOT sure if this statement is TRUE ” in our earlier example of a small copy/paste, it doesn’t matter if the source application is closed before you paste. ” because MOST of the time I have found that the DATA was LOST WHENEVER the Source Application was closed … MAY BE I am always used to Copying in to the CLIP board MORE THAN Its actual Capacity THAT I DO NOT KNOW. HOW To know the Capacity of the CLIP-BOARD ?? Sir Any answer please.
The capacity of the clipboard is a function of how much RAM you have and how many programs are running– meaning it changes over time. There’s really no way to know what it is at any given point in time.
I see the message ‘There is a large amount of information on the Cipboard….’ quite often. I just say ‘no’ if I don’t need it any more, but if I say ‘yes’ I can use it after the source application is closed.
Excel is the odd program here. If you copy anything to the clipboard in Excel that you want to paste somewhere else in Excel, doing anything inside Excel except moving around causes the information to be deleted from the clipboard. This does not happen if you switch to another program and work so it is something Excel itself is doing to the clipboard.
Why do you not use coodclip it can hold on your copies for ever even after an reboot. I use it for years now sinds w95 and i love it, mayby you love it to if you tried it.
As I mentioned in the article there are many, many, third party utilities to extend the functionality of the clipboard.
There is a wonderful little program that expands the clipboard and retains clippings almost indefinitely — ClipCache from xrayz software —
but there is a danger for hoarders: while Clipcache can also function as a very useful kind of filing cabinet and storage system, it is easily overrun with the detritus of saved clips. Nonetheless, with self-discipline, Clipcache is a very handy adjunct.
I use Ditto. it’s free and open source.
A really simple clipboard extender I use all the time is IronDust QClip. It remembers all the scraps of text I have copied during a session and makes them easy to select through using Ctrl+Alt+V instead of the usual Ctrl+V. At the next reboot, it is clear again.
Thank you, this article certainly explains a lot, for example, why copy/pasting some things into Word at times results in formatting that requires a whole lot of work to fix the appearance — sometimes it requires more than running it through a plain-text editor to remove the formatting. This is one reason why Evernote Web Clipper is so handy, it can copy most articles from the web into Evernote with decent formatting and then images or text can be removed and added for a reasonable-looking result.
Sometime try ClipMate. Many time saving features. Save clips to the program and use ‘shortcuts’ to find them.
When I use the Windows Key-Shift Key-s to quickly capture something, it is held in the clipboard and can be used to paste multiple times.
That’s the way it should work and usually does but sometimes it doesn’t. This article is about some of the times it doesn’t
How do I find the clip board? I used to teach a senior group and we were using windows XP and I found the clip board. What I would do is have a split screen, one side showing what I was going to copy from and the other side was the clip board so they could that when I hit copy it would show on the clip board side. As I recall I did a search and found clpbrd or something similar to that but I can’t find it anymore in the newer Windows… is it available to see or are we no longer able to see it?
Windows no longer appears to have a program to allow you to view the clipboard. There are many 3rd party alternatives, though, that will.
Whatever happened to the version of Clipboard that saved more than one item during a session? (I don’t recall whether that was in XP or one of the pre-XP versions of Windows.) Pasting would then ask which of the clipped items to place into the destination. That was a nice feature as I recall.
Those were third party apps, OR it was the feature within Microsoft Office only called the “Spike”.