/// blog Devlog

Why Ctrl+V can paste an image into a website: the Clipboard API, explained

Founder, imagepaste.org
/// published
Jul 23, 2026
/// read time
6 min read
Why Ctrl+V can paste an image into a website: the Clipboard API, explained
/// table of contents

I built this site around a single keystroke, so I have spent an unreasonable amount of time with the browser clipboard. This post is the plumbing tour: what is actually on your clipboard after a screenshot, how the browser decides what a page is allowed to see, and why the paste model is shaped by privacy rules more than by convenience.

What is on the clipboard after a screenshot

The OS clipboard is not a single value, it is a little bulletin board of the same content in several formats at once. Copy a chart from a spreadsheet and the clipboard might simultaneously hold a bitmap, an HTML fragment, and plain text, so that whatever app you paste into can take the richest format it understands.

After a screenshot shortcut, the board holds a bitmap in the platform's native form, a DIB on Windows, TIFF or PNG data on macOS. When a web page asks, the browser translates whatever is there into a standard web format, which in practice means you receive it as image/png. That translation is why pasted screenshots are always PNG, always crisp, and always bigger than you expect, a trade covered from the other side in the compression guide.

The paste event, from keypress to file

When you press Ctrl+V on a focused page, the browser fires a paste event carrying a DataTransfer object, the same structure drag-and-drop uses. The page walks its items, and each item announces a MIME type. Text arrives as a string; an image arrives as an item whose getAsFile() hands back a real File object, as if the user had picked it from a file dialog.

document.addEventListener('paste', (e) => {  for (const item of e.clipboardData.items) {    if (item.type.startsWith('image/')) {      const file = item.getAsFile();      // hand the file to the crop view, nothing uploaded yet    }  }});

That is genuinely most of it. The file that comes out of the clipboard flows into the same code path as a dropped or picked file. On this site that path opens the crop view, and nothing touches the network until you confirm, which is worth repeating because people assume paste means upload. It does not. Paste means the page received the bytes, and that is all.

How we got here: the execCommand era

Clipboard access on the web used to be genuinely bad. The old mechanism, document.execCommand('copy') and friends, was synchronous, quirky across browsers, and mostly limited to text selected in the page. Reading the clipboard was so locked down that a generation of sites resorted to invisible Flash movies purely to touch it, which tells you how strong the demand was and how little the platform offered.

The modern async Clipboard API replaced that with promises, proper MIME-typed payloads, and an explicit permission model, and the paste event grew reliable file access along the way. The result is the current split personality: paste-into-page is smooth and gesture-driven, programmatic access is deliberately harder. That split is not an accident of history, it is the design.

The rules: gestures, focus, and permission

Everything about clipboard access is designed around one fear: a page silently reading what you copy. Three rules follow from it.

First, paste is user-initiated. A page cannot fake a paste event to itself and receive your clipboard; the event fires because you pressed the shortcut or picked Paste from a menu. Second, only the focused document gets it. Background tabs hear nothing, which is why the Ctrl+V guide tells you to click the page once before pasting. Third, programmatic reading, where a script calls navigator.clipboard.read() on its own, sits behind an explicit permission prompt and additional gesture requirements, and browsers differ on how much they allow even then.

Writing goes the other way with looser rules, which is why the copy direction feels effortless. When the upload finishes here, navigator.clipboard.writeText() puts the short URL on your clipboard inside the click handler, and that gesture context is what makes it allowed. iOS is the strict one: Safari often wants a direct tap per write, which is why the result view keeps a Copy link button instead of relying on auto-copy.

The other direction: putting an image on the clipboard

Pages can write images too, not just text, through ClipboardItem: wrap a PNG blob, hand it to navigator.clipboard.write() inside a click handler, and a copy-image button works without any right-click. Support arrived unevenly, Chromium first, Safari and Firefox catching up later, and PNG remains the only image type every implementation agrees on. That browser gap is why copy-image buttons on the web still sometimes fall back to "right-click and copy manually" hints, and it shaped what this site promises: the guaranteed path is the URL on your clipboard, text, which writes reliably everywhere.

Where it breaks, and why

Most paste failures are the clipboard holding something other than what you think. Some Windows screenshot utilities copy a file path as text rather than the bitmap, so the page receives a string. Clipboard managers can replace the top of the board when they sync history. Remote desktop and VM software pipes the clipboard through its own channel, which sometimes forwards text but drops images entirely. The troubleshooting guide works through these one by one, but the diagnostic is always the same question: what format actually made it onto the clipboard?

Corporate browser policies are the other blocker worth knowing about. Some managed profiles disable clipboard APIs wholesale, and there is no way for a page to route around that, which is why drag-and-drop stays available here as the fallback that policy rarely touches.

What this means for your privacy, in practice

The rules add up to a reasonable deal. A web page learns what is on your clipboard only at the moment you paste it into that page, or after you grant an explicit read permission that browsers treat as sensitive. No focus, no event. No gesture, no read. It is worth knowing that the boundary sits at the browser: a clipboard manager app on your OS sees everything you ever copy by design, and no web standard governs that. The clipboard's biggest privacy surface is the software you install, not the pages you visit.

Why I think paste is the right primitive

File pickers assume your image is a file you know the location of. For screenshots that is false: the capture exists to be sent, not kept, and making it a file first is pure ceremony. The clipboard is where the OS already put it, one keystroke ago. Building the whole flow on the paste event removes every step between capture and share except the ones that add value, the optional crop and the explicit send. The browser API that makes that possible is small, strict about consent, and, once you have fought with its edge cases for a while, quietly excellent.

/// frequently asked

Can a website read my clipboard without me knowing?

Not through the paste path. Paste events fire only when you press the shortcut or pick Paste yourself, on the focused page. Programmatic reading through navigator.clipboard.read requires an explicit permission prompt, and browsers gate it hard.

Why does paste only work when the tab is focused?

Browsers deliver paste events only to the active, focused document. It is a deliberate privacy rule: without it, any background tab could sit listening and collect whatever you copy.

Why do pasted screenshots come out as PNG?

Operating systems keep screenshots on the clipboard in a lossless bitmap form, and browsers expose that to pages as image/png. Lossless is why text stays crisp, and also why the files are bigger than JPEGs.

Does pasting an image upload it immediately?

Not on this site. Pasting hands the image to the page, which opens the crop view. The upload starts only when you confirm, so closing the tab before that sends nothing.

/// related