# clipboard
> Perform copy and paste operations on the system clipboard.
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
On Linux, there is also a `selection` clipboard. To manipulate it
you need to pass `selection` to each method:
```javascript
const { clipboard } = require('electron')
clipboard.writeText('Example string', 'selection')
console.log(clipboard.readText('selection'))
```
## Methods
The `clipboard` module has the following methods:
**Note:** Experimental APIs are marked as such and could be removed in future.
### `clipboard.readText([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `string` - The content in the clipboard as plain text.
```js
const { clipboard } = require('electron')
clipboard.writeText('hello i am a bit of text!')
const text = clipboard.readText()
console.log(text)
// hello i am a bit of text!'
```
### `clipboard.writeText(text[, type])`
* `text` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `text` into the clipboard as plain text.
```js
const { clipboard } = require('electron')
const text = 'hello i am a bit of text!'
clipboard.writeText(text)
```
### `clipboard.readHTML([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `string` - The content in the clipboard as markup.
```js
const { clipboard } = require('electron')
clipboard.writeHTML('Hi')
const html = clipboard.readHTML()
console.log(html)
// Hi
```
### `clipboard.writeHTML(markup[, type])`
* `markup` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes `markup` to the clipboard.
```js
const { clipboard } = require('electron')
clipboard.writeHTML('HiHi',
rtf: '{\\rtf1\\utf8 text}',
bookmark: 'a title'
})
console.log(clipboard.readText())
// 'test'
console.log(clipboard.readHTML())
// Hi
console.log(clipboard.readRTF())
// '{\\rtf1\\utf8 text}'
console.log(clipboard.readBookmark())
// { title: 'a title', url: 'test' }
```