In JavaScript, the paste event fires when the user starts a paste action through the browser UI (MDN). In an editable context (<input>, <textarea>, or contenteditable), the default action inserts clipboard contents at the cursor.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for paste. Start with this line.
JavaScript
addEventListener("paste", fn)
Call
What it does
addEventListener("paste", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("paste", …) — no import required.
Library declarations
JavaScript
addEventListener("paste", fn)
Parameters
Parameter
Description
Event name
Required. "paste"
Handler prop
Optional. onpaste
Return Value
Return Value
Description
*
Fires as an Element event (listener receives the Event object).
JavaScript Examples
Example 1 — Paste as Uppercase (MDN)
Cancel default insert, uppercase clipboard text, then insert it.
Target one element. Only that control’s paste default is canceled.
Call preventDefault(). Stops the browser from inserting clipboard contents.
UX, not security. Users can still type or use other APIs — explain why paste is disabled.
Prefer clear labels when paste is intentionally blocked (accessibility).
Compatibility
Browser Support
Elementpaste is Baseline Widely available (MDN: since July 2015). Safe to use in modern and older evergreen browsers.
✓ Baseline · Widely available
paste
Fires when the user initiates a paste action through the browser UI.
99%Widely available
Google ChromeYes
Yes
Microsoft EdgeYes
Yes
Mozilla FirefoxYes
Yes
Apple SafariYes
Yes
OperaYes
Yes
Internet ExplorerYes (legacy)
Yes
pasteExcellent
Bottom line: Use paste to observe or customize the user’s paste gesture. Read with clipboardData.getData; cancel + insert when transforming. See the MDN paste reference.
Frequently Asked Questions
It fires when the user starts a paste action through the browser UI (for example Ctrl+V / Cmd+V or Edit → Paste). In an editable context, the default action inserts clipboard contents at the cursor (MDN).
No. MDN marks Element paste as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A ClipboardEvent. The important property is clipboardData, which you can read with getData(format) in a paste handler.
Call event.preventDefault() to cancel the default insert, read clipboardData.getData("text"), transform it, then insert the result yourself (MDN).
No. You can construct and dispatch a paste event, but MDN notes that doing so will not affect the document’s contents.
paste is inbound and can read clipboardData. copy and cut are outbound: handlers typically write with setData and cannot read the clipboard.