Allow pasting in the Chrome console: what the DevTools warning means and how to clear it
Updated · 6 min read
To allow pasting in the Chrome DevTools Console, paste once so the warning appears, then type allow pasting without quotes and press Enter. Paste again and it goes through. Chrome saves the choice in your profile, so you normally see the warning only once. The block exists to stop self-XSS scams, where someone talks you into running their code on a site where you are logged in.
Steps
- 1
Open the Console
Press Ctrl+Shift+J (Cmd+Option+J on a Mac) to open DevTools on the Console panel.
- 2
Paste once to trigger the warning
Paste your code. Chrome does not insert it and logs a yellow warning that starts with "Don't paste code into the DevTools Console that you don't understand or haven't reviewed yourself".
- 3
Type allow pasting and press Enter
Click the Console prompt, type
allow pastingexactly as written, without quotes, and press Enter. If your DevTools runs in another language, type the phrase the warning shows. - 4
Paste again
Paste the code a second time. It lands in the prompt, and you can read it before pressing Enter to run it.
Why Chrome says "Don't paste code into the DevTools Console"
When pasting is blocked, the Console logs this message in current Chrome:
Warning: Don't paste code into the DevTools Console that you don't understand or haven't reviewed yourself. This could allow attackers to steal your identity or take control of your computer. Type "allow pasting" below and press Enter to allow pasting.Older Chrome versions phrased the last sentence as "Please type 'allow pasting' below and hit Enter". The meaning is the same.
The Chrome team explains the reasoning in How Chrome DevTools helps to defend against self-XSS attacks. Pasting is a core DevTools feature, so Chrome only blocks it for profiles that look new to DevTools. If your profile has at least 5 entries in its Console history, Chrome skips the warning. That is why people who use DevTools every day rarely see it, and why it shows up on a fresh profile or a new machine.
How to type allow pasting in the Console
Most "allow pasting not working" reports come down to one of these details. DevTools compares what you type against the phrase exactly.
- Paste first. The phrase only unlocks pasting while the warning is active, so typing it before you have pasted does nothing special.
- Leave out the double quotes.
"allow pasting"is a JavaScript string, so the Console prints it back and pasting stays blocked. Plainallow pastingworks, and so does'allow pasting'in single quotes. - Watch for extra spaces, a capital letter or autocomplete adding characters. Clear the prompt and type it again if in doubt.
- If your DevTools language is not English, the phrase is translated. Type the one shown in your warning.
- Press Enter after typing. Chrome echoes the phrase in the Console and clears the prompt.
After that, pasting works in the Console for that profile.
Allow pasting in the Sources panel and Snippets
The code editors in DevTools, such as a snippet in Sources > Snippets, have the same protection. Instead of a Console message you get a dialog with a text field. Type allow pasting into the field, confirm, then paste. Closing the dialog without typing the phrase leaves pasting blocked.
Microsoft Edge is built on Chromium and behaves the same way. Its docs cover both cases in Allow pasting into the Console and Allow pasting into the Snippet editor.
When the warning comes back
Chrome stores the "allow pasting" choice as a DevTools setting in your browser profile. You see the warning again when that setting is missing.
- You use a new Chrome profile or a new install.
- You reset DevTools with Settings > Preferences > Restore defaults and reload.
- You hit a rare bug the Chrome team mentions in its self-XSS post, where the warning keeps returning. Its suggested fix is to create a new profile.
For automated testing, start Chrome with --unsafely-disable-devtools-self-xss-warnings to skip the warnings entirely. Chrome for Testing has them turned off by default. Keep the flag out of the browser you use day to day.
# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --unsafely-disable-devtools-self-xss-warnings
# Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --unsafely-disable-devtools-self-xss-warningsIs it safe to allow pasting? The self-XSS risk
Self-XSS is social engineering. A scammer cannot inject a script into a site, so they ask you to run it for them. The usual pitch is "paste this into the console to unlock a feature", "claim free credits" or "verify your account". Code in the Console runs with the page's full access, as you.
- It can read anything the page can, including
localStorage,sessionStorageand cookies that are not markedHttpOnly. Many apps keep login tokens there. - It can call the site's API with your session. That means sending messages, changing settings or moving money.
- It can send what it finds to another server with a single
fetchcall.
Typing allow pasting is fine when you are a developer pasting code you wrote or can read. The phrase only removes a speed bump. What matters is reading every paste before you press Enter.
Safer ways to run code you copied
Paste into a Snippet when you will run the same code more than once. Open Sources > Snippets, click New snippet, paste, save, then run it with Ctrl+Enter (Cmd+Enter on a Mac). You can also open the Command Menu with Ctrl+Shift+P (Cmd+Shift+P), delete the > and type ! plus the snippet name. Saved code is easier to review than a one-off paste. The Chrome Snippets docs cover the details.
A common reason to paste is a request you copied as fetch from the Network panel. Read it before you run it:
- The URL points at the site you expect, not some other host.
- The method matches what you want. A
DELETEorPOSTchanges data on the server. - The body holds plain JSON or form data, with no long encoded strings you cannot read.
- There is no extra code around the
fetch, such aseval,atobor a second request that sendsdocument.cookiesomewhere.
If you only need the response, Copy as cURL and run it in a terminal. It runs outside the page, so it cannot read the page's storage. The command does carry your cookies and auth headers, so treat it like a password and do not paste it into chats or tickets.
Replay a request without pasting, using Netraptor
Netraptor is a Chrome extension that adds a Netraptor panel to DevTools. It lists the requests of the inspected tab as soon as the panel is open. Right-click any request to replay or copy it, so you skip the copy, paste and allow pasting round trip.
- Resend runs the same request again with
fetchinside the inspected page, using the page's cookies. The new request appears in the list tagged Resent. - Edit and resend as fetch opens a form where you change the method, URL, headers and body before sending.
- Copy offers cURL (bash), cURL (cmd), PowerShell, fetch and Node.js fetch, plus Copy response and Copy all as HAR.
Resend sends only the captured request. It leaves out headers the browser sets itself, such as Cookie, Origin and User-Agent, and lets Chrome add them. It works on live traffic only, not on saved history, because it needs the page you are inspecting. Copy and Resend are in the Free plan.
If you are pasting to read a token from a request, see JWT decode in Chrome. To list every call an app makes, see how to find the API endpoints of a web app.
Frequently asked questions
- How do I enable pasting in the Chrome console?
- Paste once so the warning appears, type
allow pastingin the Console prompt and press Enter. Paste again and it works. In the Sources editor, type the phrase into the dialog's text field instead. - Why is allow pasting not working?
- Usually it has double quotes, an extra space or a typo, or you typed it before the warning appeared. Type
allow pastingwith no quotes right after the warning. If DevTools is in another language, use the translated phrase it shows. - Can I turn off the paste warning permanently?
- Typing
allow pastingonce turns it off for that Chrome profile. For test automation, start Chrome with--unsafely-disable-devtools-self-xss-warnings, or use Chrome for Testing, where the warnings are off. - Is it safe to type allow pasting?
- The phrase itself is harmless. It turns off a warning. The risk is the code you paste afterwards, which runs with your login on that site. Only paste code you wrote or have read line by line.
- What is self-XSS?
- Self cross-site scripting is a scam where someone tricks you into running their JavaScript in your own browser, often in the DevTools Console. The code then acts as you on that site and can steal tokens or make requests.
- Does Microsoft Edge show the same warning?
- Yes. Edge uses the same DevTools code, so it blocks pasting the same way and accepts the same
allow pastingphrase and command-line flag.