Open main menu

Wikipedia β

Clipboard (computing)

  (Redirected from Clipboard (software))
Simple representation of a clipboard (computing)

The clipboard is a data buffer used for short-term data storage and/or data transfer between documents or applications used by cut, copy and paste operations and provided by the operating system. It is usually implemented as an anonymous, temporary data buffer, sometimes called the paste buffer, that can be accessed from most or all programs within the environment via defined programming interfaces. A typical application accesses clipboard functionality by mapping user input (keybindings, menu selections, etc.) to these interfaces. The semantics of the clipboard facility varies from one operating system to another, and can also vary between versions of the same system. They can sometimes be changed by different programs or by user preference.

When an element is copied or cut the clipboard holds every available format of it, since at this point it is not known, which format is needed when the content is pasted. The core functionality of the clipboard provided by the operating system can be extended by applications and clipboard managers.

Windows, Linux and Mac-OS support a single clipboard transaction.[1] Each cut or copy overwrites the previous contents. Normally, paste operations copy the contents, leaving the contents available in the clipboard for further pasting operations. Clipboard data is stored in the RAM.[2]

Drag and drop enables users to drag and drop information from one control to another similar to the functionality of cut, copy and paste from the users view, but it doesn't affect the clipboard.[3]



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.[4] 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 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.[5]

Data formatsEdit

Clipboards support the storing of multiple types of data simultaneously, allowing complex data structures to be stored. These range from styled text formats such as RTF or HTML, through a variety of bitmap and vector image formats to complex data types like spreadsheets and database entries.

For example, cutting a range of cells in a spreadsheet and then pasting them into another sheet may preserve the underlying formulae and data, and may even translate intra-cell references, so that a "SUM(...)" calculation on a sub-range of the cells is converted to refer to the newly pasted copies of those cells.

When data is added to the clipboard by an application, the application typically makes it available in as many different data formats as it can. This includes both native and simpler (or more common) formats that would have a higher chance of being recognized by a wide variety of applications. Thus, when data is pasted into another application, the format that is closest to that application's native format can be used, preserving as much of the original data as possible.

Formats stored in the clipboard using Ubuntu
title of this article (article opened in Mozilla Firefox) python script in downloads clipboard pictogram from this article
available formats in clipboard 'TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TARGETS', 'text/html', 'text/_moz_htmlcontext', 'text/_moz_htmlinfo', 'text/plain', 'COMPOUND_TEXT', 'text/x-moz-url-priv' 'TIMESTAMP', 'TARGETS', 'MULTIPLE', 'x-special/gnome-copied-files', 'text/uri-list', 'text/plain', 'COMPOUND_TEXT', 'text/plain;charset=utf-8' 'TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TARGETS', 'text/html', 'text/_moz_htmlinfo', 'text/_moz_htmlcontext', 'image/png', 'image/tiff', 'image/x-icon', 'image/x-ico', 'image/x-win-bitmap', 'image/jpeg', 'image/bmp', 'image/x-bmp', 'image/x-MS-bmp', 'application/x-qt-image'
TIMESTAMP '\xdb\xdb\n\x00' @\x07\x0f\x00 '\xb0$\x1e\x00'
TARGETS '\xb1\x01\x00\x00\xaf\x01\x00\x00\xb0\x01\x00\x00\xc6\x01\x00

\x00)\x02\x00\x00*\x02\x00\x00+\x02\x0 [...]


\x008\x02\x00\x00\x13\x01\x00\x00\xd7\x01 [...]


\x01\x00\x00)\x02\x00\x00+\x02\x00\x00*\x02\x0 [...]

MULTIPLE [empty] [empty] [empty]
SAVE TARGETS [empty] - [empty]
text/html '\xff\xfe<\x00h\x001\x00 \x00i\x00d\x00=\x00"\x00f\x00i\x00r\x00s

\x00t\x00H\x00e\x00a\x00d\x00i\x00 [...]

'\xff\xfe<\x00i\x00m\x00g\x00 \x00a\x00l\x00t\x00=\x00"

\x00"\x00 \x00s\x00r\x00c\x00=\x00"\x00h\x00 [...]

text/_moz_htmlcontext '<\x00h\x00t\x00m\x00l\x00 \x00c\x00l\x00a\x00s\x00s\x00=\x00"

\x00c\x00l\x00i\x00e\x00n\x00t\x00-\x [...]

text/_moz_htmlinfo '0\x00,\x000\x00' '0\x00,\x000\x00'
text/plain 'Clipboard (computing)' '/home/user/Downloads/' -
COMPOUND_TEXT 'Clipboard (computing)' '/home/user/Downloads/'
text/x-moz-url-priv 'h\x00t\x00t\x00p\x00s\x00:\x00/\x00/\x00e\x00n\x00.\x00w\x00i\x00k

\x00i\x00p\x00e\x00d\x00i\x00a\x [...]

x-special/gnome-copied-files - 'copy\nfile:///home/user/Downloads/'
text/uri-list 'file:///home/user/Downloads/\r\n'
text/plain;charset=utf-8 '/home/user/Downloads/'
image/png - '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\xdc

\x00\x00\x00\xf4\x08\x06\x00\x00\x00\xf0\xa5H\x [...]

image/tiff [empty]
image/x-icon, image/x-ico, image/x-win-bitmap '\x00\x00\x01\x00\x01\x00\xdc\xf4\x00\x00\x01\x00 \x00

\x98a\x03\x00\x16\x00\x00\x00(\x00\x00\x00\xd [...]

image/jpeg '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00

\x01\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\ [...]

image/bmp, image/x-bmp, image/x-MS-bmp 'BMFu\x02\x00\x00\x00\x00\x006\x00\x00\x00(\x00\x00\x00

\xdc\x00\x00\x00\xf4\x00\x00\x00\x01\x00\x18 [...]

application/x-qt-image '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\xdc\x00

\x00\x00\xf4\x08\x06\x00\x00\x00\xf0\xa5H\x [...]

Computer securityEdit

Clipboard hijacking 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.[6] While some security-holes were patched, JavaScript can still be used to modify clipboard content via an attack dubbed 'pastejacking'.[7][8] 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.[9]

There have been exploits where web pages grab clipboard data. In early 2013 researchers exposed risks stemming from Android-based password managers 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.[10] Joe Siegrist notes that this is an "OS-level issue that impacts everything running on Android".[11]

Clipboard management and extensionsEdit

Glipper, an example of a clipboard management program

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.

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 his or her system the clipboard contents are deleted – an added functionality is to save the clipboard persistent. 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 clipboardsEdit

Microsoft WindowsEdit

The clipboard in Microsoft Windows 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:[12]

  • standard formats[13] (e.g. CF_BITMAP, or CF_UNICODETEXT),
  • registered formats[14] (e.g. CF_HTML)
  • private formats for internal use

Up to and including Windows XP the clipboard could be accessed via the Clipbook Viewer application.[15] In newer versions of Windows the content can be accessed via clipboard managers.

The clipboard can also be accessed via Powershell:[16][17]

# to paste the content of a directory to the clipboard
Set-Clipboard -Path "C:\directory\"
# to get the content of the clipboard

Data can be stored to the clipboard via command line:[18]

$ # to paste the content of a folder to the clipboard:
$ dir | clip


The clipboard in macOS 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.[19]

Using the following commands the clipboard can be accessed from the command line:[20] [21]

$ # to copy data into the clipboard:
$ echo 'hello world' | pbcopy
$ # to paste from the clipboard:
$ pbpaste 
hello world

X Window SystemEdit

The X Window System commonly used on Unix and Linux systems provides three clipboards, which are named "PRIMARY", "SECONDARY" and "CLIPBOARD".[22]

The usage and handling of various selections is not standardized. However most modern toolkits and desktop environments, such as GNOME or KDE, follow a widely accepted convention, outlined in the specification.[23] 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.[24] This copied data is usually separated from the CLIPBOARD selection and does not change its contents.[25] SECONDARY was planned as an alternative to PRIMARY but is only used inconsistently.[22]

There are two command line tools (xsel and xlclip) which can access the clipboard:[26]

$ # to paste standard output to the clipboard using xclip
$ echo text | xclip -in -selection clipboard
$ # to paste standard output to the clipboard usingxsel
$ 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 owernship of the CLIPBOARD selection and communicates its ownership to the X Server.[24] When pasting this data, the data and its available formats are requested from the application that owns the CLIPBOARD selection.[27]


The Amiga operating system uses 256 units, so one has multiple clipboards at the same time.[28]


Android provides a clipboard framework which can hold up to one clip object and is accessible system-wide. While simple text data is stored directly in the clipboard complex data is stored by reference. The format of the clip object has one of three forms:[29]

  • text strings
  • URI objects
  • Intents

The data cointained in the clipboard can't be accessed via the GUI but only from the system and applications.

If one wants to interact with the clipboard as part of an application one should use the class ClipboardManager[30] which fascilates copying and pasting data structures and streams.


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.[31]

The formats are identified by Uniform Type Identifiers (UTI).[32]

The data cointained in the pasteboard can't be accessed via the GUI but only from the system and applications.


Applications can access the clipboard or its data via APIs.


In JavaScript a class which detects changes in the users clipboard data (ClipboardEvent)[33] and functions to alter the content of a clipboard or read from it (clipboardData.getData(), clipboardData.setData())[34] exist, but aren't supported by every browser since altering the clipboard of a user can represent a security issue.


in Qt a wrapper for every supported platform[35] (e.g. Windows or OS X) 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.[36] 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 alsoEdit


  1. ^ Kimmatkar, Sarang B. (2014). "Extending functionalities of default clipboard". (IJCSIT) International Journal of Computer Science and Information Technologies 5. 6. 
  2. ^ "What is a Clipboard in Computing? - Definition from Techopedia". Retrieved 2018-02-01. 
  3. ^ Stephens, Rod, (2010). Visual Basic 2010 : programmer's reference. Indianapolis, IN: Wiley Pub. p. 555. ISBN 9780470499832. OCLC 630689447. 
  4. ^ Moggridge, Bill (2007). Designing interactions. Cambridge, Mass: MIT Press. p. 65ff. ISBN 9780262134743. 
  5. ^ Larry Tesler. "A User Experience Retrospective". Retrieved 23 January 2018. 
  6. ^ "What is clipboard hijack attack? - Definition from". Retrieved 4 January 2017. 
  7. ^ Chirgwin, Richard. "Pastejack attack turns your clipboard into a threat". The Register. Retrieved 4 January 2017. 
  8. ^ "Researcher warns of 'pastejacking' hack attacks targeting users' clipboards". Graham Cluley. 26 May 2016. Retrieved 4 January 2017. 
  9. ^ "dxa4481/Pastejacking". GitHub. Retrieved 4 January 2017. 
  10. ^ "Hey, You, Get Off of My Clipboard" (PDF). doi:10.1007/978-3-642-39884-1_12. Retrieved 4 January 2017. 
  11. ^ "Using a password manager on Android? It may be wide open to sniffing attacks". Ars Technica. Retrieved 4 January 2017. 
  12. ^ "Clipboard Formats (Windows)". Retrieved 2018-02-03. 
  13. ^ "Standard Clipboard Formats (Windows)". Retrieved 2018-02-03. 
  14. ^ "HTML Clipboard Format (Internet Explorer)". Retrieved 2018-02-03. 
  15. ^ "View & Manage Clipboard In Windows 10/8/7". The Windows Club. 2013-04-12. Retrieved 2018-02-06. 
  16. ^ sdwheeler. "Get-Clipboard (Microsoft.PowerShell.Management)". Retrieved 2018-02-06. 
  17. ^ sdwheeler. "Set-Clipboard (Microsoft.PowerShell.Management)". Retrieved 2018-02-06. 
  18. ^ "How to Copy Command Line Output to the Windows Clipboard". Retrieved 2018-02-06. 
  19. ^ "ClipboardViewer". Retrieved 2018-02-06. 
  20. ^ "Copy to clipboard from terminal in OS X". 
  21. ^ "pbcopy(1) Mac OS X Manual Page". 
  22. ^ a b "Clipboard - ArchWiki". Retrieved 2018-02-16. 
  23. ^ "clipboards-spec". Retrieved 2014-08-16. 
  24. ^ a b "Copy & Paste, Drag & Drop [MI Wiki]". (in German). Retrieved 2018-02-16. 
  25. ^ "". Retrieved 2018-02-16. 
  26. ^ "Copying and Pasting To and From the System Clipboard On The Command Line — Fernando Basso". Retrieved 2018-02-06. 
  27. ^ "X Selections, X Cut Buffers, and Emacs Kill Rings". Retrieved 2018-02-02. 
  28. ^ "Clipboard Device - AmigaOS Documentation Wiki". Retrieved 2018-02-03. 
  29. ^ "Copy and Paste | Android Developers". Retrieved 2018-02-06. 
  30. ^ "ClipboardManager | Android Developers". Retrieved 2018-02-02. 
  31. ^ "Pasteboard". Retrieved 2018-02-01. 
  32. ^ "Uniform Type Identifier". Retrieved 2018-02-06. 
  33. ^ "Clipboard API and events – ClipboardEvent". Retrieved 2018-02-08. 
  34. ^ "Clipboard API and events – Synchronous Clipboard API". Retrieved 2018-02-08. 
  35. ^ "platforms\plugins\src - qt/qtbase.git - Qt Base (Core, Gui, Widgets, Network, ...)". Retrieved 2018-02-02. 
  36. ^ "QClipboard Class | Qt GUI 5.10". Retrieved 2018-02-02.