The clipboard is a buffer that some
operating systems
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
provide for short-term storage and transfer within and between application programs. The clipboard is usually temporary and unnamed, and its contents reside in the computer's
RAM.
The clipboard provides an
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
by which programs can specify
cut, copy and paste
Cut, copy, and paste are essential commands of modern human–computer interaction and user interface design. They offer an interprocess communication technique for transferring data through a computer's user interface. The ''cut'' command rem ...
operations. It is left to the program to define methods for the user to command these operations, which may include
keybindings and
menu selections. When an element is
copied or cut, the clipboard must store enough information to enable a sensible result no matter where the element is pasted. Application programs may extend the clipboard functions that the operating system provides. A
clipboard manager may give the user additional control over the clipboard. Specific clipboard
semantics
Semantics is the study of linguistic Meaning (philosophy), meaning. It examines what meaning is, how words get their meaning, and how the meaning of a complex expression depends on its parts. Part of this process involves the distinction betwee ...
vary among operating systems, can also vary between versions of the same system, and can sometimes be changed by programs and by user preferences.
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
support a single clipboard transaction.
History
Clipboards as buffers for small text snippets were first used by
Pentti Kanerva when he used it to store deleted texts in order to restore them. Since one could delete a text in one place and restore it in another, the term "delete" wasn't what one would expect in this case.
Larry Tesler
Lawrence Gordon Tesler (April 24, 1945 – February 16, 2020) was an American computer scientist who worked in the field of human–computer interaction. Tesler worked at Xerox PARC, Apple Inc., Apple, Amazon.com, Amazon, and Yahoo!.
While at PA ...
renamed this in 1973 as
cut, copy, and paste and coined the term "clipboard" for this buffer, since these techniques need a clipboard for temporary saving the copied or cut data.
Data formats
Applications communicate through the clipboard by providing either
serialized representations of an object, or a promise (for larger objects). In some circumstances, the transfer of certain common data formats may be achieved opaquely through the use of an
abstract factory; for example,
Mac OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
uses a class called ''NSImage'' to provide access to image data stored on the clipboard, though the actual format of the image data backing the object is hidden. The sending and receiving application negotiate the formats which can be transferred in between them, oftentimes with the active
GUI widget
A graphical widget (also graphical control element or control) in a graphical user interface is an element of interaction, such as a button or a scroll bar. Controls are software components that a computer user interacts with through direct m ...
responsible for providing acceptable type transformations. The pasteboard allows for transfer of common items such as URLs, colors, images, strings, attributed strings (
Rich text), and sounds. The operating system and GUI toolkit may provide some common conversions, for example converting from
rich text to
plain text
In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects ( floating-point numbers, images, etc.). It may also include a lim ...
and vice versa. Various type identifiers for data transfer are supported by modern operating systems, which may automatically provide acceptable mappings between type systems, such as between
MIME
A mime artist, or simply mime (from Greek language, Greek , , "imitator, actor"), is a person who uses ''mime'' (also called ''pantomime'' outside of Britain), the acting out of a story through body motions without the use of speech, as a the ...
and
Uniform Type Identifier.
Computer security
Clipboard hijacking or clipboard injection is an
exploit in which a person's clipboard's content is replaced by malicious data, such as a link to a malicious web site. For example, if a user copies a
cryptocurrency
A cryptocurrency (colloquially crypto) is a digital currency designed to work through a computer network that is not reliant on any central authority, such as a government or bank, to uphold or maintain it.
Individual coin ownership record ...
receiving address into the clipboard, a hijacking program can overwrite it with an address controlled by the hijacker, so that when the user pastes the address their cryptocurrency is transmitted to the hijacker instead of the intended recipient. While some security-holes were patched,
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
can still be used to modify clipboard content via an attack dubbed 'pastejacking'. Dylan Ayrey who developed the attack set up a website that demonstrates how this exploit can be used to trick a user into running commands they didn't want to run.
There have been exploits where web pages grab clipboard data. In early 2013 researchers exposed risks stemming from
Android-based
password manager
A password manager is a software program to prevent password fatigue by Random password generator, automatically generating, Autofill, autofilling and storing Password, passwords. It can do this for Application software, local applications or web ...
s and documented how passwords in 21 of the most popular of these apps could be accessed by any other app on an Android device including those with extremely low-level privileges. Joe Siegrist notes that this is an "
OS-level issue that impacts everything running on Android".
[
]
Clipboard management and extensions
Clipboard manager extensions add functionality to the integrated clipboard functions of an operating system. They are applications that enable the user to manipulate the clipboard. On platforms such as Linux that use multiple incompatible GUI toolkits, clipboard managers are often used to transfer data between applications using different such frameworks.
When a clipboard manager provides multiple cut and paste transactions, the clipboard is treated as a stack or scrap book, with new cuts and copies being placed on a list of recent transactions. The standard paste operation copies the most recent transaction, while specialized pastes provide access to the other stored transactions. These managers generally also provide a window that displays the transaction history and allows the user to select earlier copies, edit them, change their format and even search amongst them.
Since most operating systems (e.g. Windows, macOS, Linux, X11, Android, iOS) do not save the clipboard contents to any persistent storage – when a user logs out or reboots the system the clipboard contents are deleted – an added functionality is to save the clipboard persistently. Another example is making the local clipboard work with online applications by saving the clipboard data to the online location upon a copy or cut event, making this data available to online applications for pasting. Clipboard managers can also serve as tools to overcome the limitation of software not supporting copying and pasting (for example, while logging into remote Windows server, one cannot copy and paste their user name and password).
Operating system-specific clipboards
AmigaOS
The Amiga
Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
operating system uses 256 units, so one has multiple clipboards at the same time.
Android
Android provides a clipboard that can hold up to one clip object and is accessible system-wide. Simple text is stored directly in the clipboard; complex data are stored by reference. The clip object has one of three formats: text string, URI object, or intent.
To interact with the clipboard, an app uses the class ClipboardManager and system calls to cut, copy, and paste objects.
In Android 8.0, the clipboard first appears in the user interface: In a situation where the user prepares to paste from the clipboard, a "Clipboard" option appears that gives the user access to many objects copied or cut to the clipboard in the past. Apart from that, and in earlier versions, the user has no access to the clipboard except in apps that make it available to the user.
iOS
The clipboard is called "pasteboard" in iOS similar to OS X. Apps on this operating system can create additional pasteboards, called instances of the UIPasteboard class, which can be public or private. One instance can hold a single item or multiple items in different formats.
The formats are identified by Uniform Type Identifiers (UTI).
The data contained in the pasteboard cannot be accessed via the GUI but only from the system and applications
macOS
The clipboard in macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
holds one item in multiple available formats.
The contents of the clipboard can be viewed by selecting the Show Clipboard menu item from the Finder's Edit menu. The raw data and the stored formats can be seen using the ClipboardViewer.
Using the following commands the clipboard can be accessed from the command line:
$ # to copy data into the clipboard:
$ echo 'hello world' , pbcopy
$ # to paste from the clipboard:
$ pbpaste
hello world
Microsoft Windows and ReactOS
The clipboard in Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and ReactOS
ReactOS is a Free and open-source software, free and open-source operating system for i586/amd64 personal computers that is intended to be binary-code compatibility, binary-compatible with computer programs and device drivers developed for Wind ...
holds one item in multiple available formats.
Every item has at least one clipboard format, but can have different types of format of the same data. The three different types of possible formats are:
* standard formats (e.g. CF_BITMAP, or CF_UNICODETEXT),
* registered formats (e.g. CF_HTML)
* private formats for internal use
Up to and including Windows XP
Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct successor to Windows 2000 for high-end and business users a ...
the clipboard could be accessed via the ClipBook Viewer application. In newer versions of Windows the content can be accessed via clipboard managers.
Data can be stored to the Windows and ReactOS clipboard via command line using the clip command
Command may refer to:
Computing
* Command (computing), a statement in a computer language
* command (Unix), a Unix command
* COMMAND.COM, the default operating system shell and command-line interpreter for DOS
* Command key, a modifier key on A ...
:
$ # to paste the content of a folder to the clipboard:
$ dir , clip
The clipboard can also be accessed via PowerShell
PowerShell is a shell program developed by Microsoft for task automation and configuration management. As is typical for a shell, it provides a command-line interpreter for interactive use and a script interpreter for automation via a langu ...
:
# to paste the content of a directory to the clipboard
Set-Clipboard -Path "C:\directory\"
# to get the content of the clipboard
Get-Clipboard
Windows 10
Windows 10 is a major release of Microsoft's Windows NT operating system. The successor to Windows 8.1, it was Software release cycle#Release to manufacturing (RTM), released to manufacturing on July 15, 2015, and later to retail on July 2 ...
and Windows 11
Windows 11 is a version of Microsoft's Windows NT operating system, released on October 5, 2021, as the successor to Windows 10 (2015). It is available as a free upgrade for devices running Windows 10 that meet the #System requirements, Windo ...
include the Clipboard application, allowing for the storage of multiple text-based clipboard items. It can be accessed by pressing Windows+V.
Symbian
Symbian S60 ( Series 60), depending on edition, has a built-in clipboard with image and richtext storing support.
In S60v3 (S60 3rd Edition, Symbian 9.1-9.2) examples of clipboard provided with the SDK: ..\Examples\SysLibs\Clipboard\Basics
. To read and write clipboard used CPlainText
Class:
In Symbian Belle, clipboard support defined with CClipboard
Class in the Basic Application Framework Library (BAFL).
There was a number of free and commercial third party clipboard managing applications with multi-item clipboard support created for different Symbian editions.
X Window System
The X Window System
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
commonly used on Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
systems provides three clipboards, which are named "CLIPBOARD", "PRIMARY" and "SECONDARY". The usage and handling of various selections is not standardized. However, most modern toolkits and desktop environments, such as GNOME or KDE
KDE is an international free software community that develops free and open-source software. As a central development hub, it provides tools and resources that enable collaborative work on its projects. Its products include the KDE Plasma gra ...
, follow a widely accepted convention, outlined in the freedesktop.org specification. One selection, CLIPBOARD, is used for traditional clipboard semantics, with shortcuts identical to Windows. Another selection, PRIMARY, is an X11-specific mechanism. Data is "copied" immediately upon highlighting and pasted with the third (middle) mouse button. This copied data is usually separated from the CLIPBOARD selection and does not change its contents. SECONDARY was planned as an alternative to PRIMARY but is only used inconsistently.[
There are two command line tools (xsel and xclip) which can access the clipboard:
$ # to paste standard output to the clipboard using xclip
$ echo text , xclip -in -selection clipboard
$ # to paste standard output to the clipboard using xsel
$ echo text , xsel --clipboard
The main difference to OS X and Windows is that no data is actually stored in the CLIPBOARD-clipboard but only the reference to the copied or cut data. The application claims the ownership of the CLIPBOARD selection and communicates its ownership to the X Server.][ When pasting this data, the data and its available formats are requested from the application that owns the CLIPBOARD selection.
]
APIs
Applications can access the clipboard or its data via APIs.
JavaScript
In JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
a class which detects changes in the users clipboard data (ClipboardEvent) and functions to alter the content of a clipboard or read from it (clipboardData.getData(), clipboardData.setData()) exist, but aren't supported by every browser since altering the clipboard of a user can represent a security issue.
Qt
In Qt a wrapper for every supported platform exists. It provides access to window system clipboards with the use of the class QClipboard. This class facilitates access to common data types by functions. The data type of the element stored in the clipboard is indicated via MIME and MIME data can also be put in the clipboard with help of functions from this class.
See also
* Clipboard manager
* Cut, copy, and paste
References
Further reading
*
*
External links
clip , Microsoft Docs
in the ICCCM
Windows Dev Center: Transferring Shell Objects with Drag-and-Drop and the Clipboard
Microsoft Developer Network: How the Clipboard Works, Part 1
Microsoft Developer Network: How the Clipboard Works, Part 2
Microsoft Developer Network: Delayed Rendering of Clipboard Data
{{Windows commands
User interface techniques