Disable Paste Protection in Chrome DevTools: How-To
In this article
You cannot fully disable Chrome DevTools' paste protection with a single toggle, but you can work around it: type allow pasting in the DevTools Console and press Enter, then paste normally. This is the official method Chrome provides. The protection exists to stop malicious sites from tricking you into pasting harmful code into the Console, so it is a safety feature, not a bug. If you need to paste code regularly, you can also use Snippets or save the code to a file and load it, which avoids the prompt entirely. This guide covers the official workaround, the reasons behind the protection, and what to do if it does not behave as expected.
What You'll Need
- Google Chrome on desktop (Windows, macOS, or Linux). The paste protection and the
allow pastingworkaround are desktop-only; mobile Chrome does not include DevTools. - DevTools open (press
F12orCtrl+Shift+Ion Windows/Linux,Cmd+Option+Ion macOS). - The code or text you want to paste, ready in your clipboard.
- Basic awareness that pasting unknown code into the Console can run with the page's privileges. Only paste code you trust.
Step-by-Step
- Open DevTools. With the page you are working on active, press
F12(Windows/Linux) orCmd+Option+I(macOS). You can also right-click anywhere on the page and choose Inspect. The DevTools panel opens docked to the side or bottom. - Switch to the Console tab. At the top of DevTools, click Console. If you do not see it, click the More tabs button (the double-chevron) and select Console from the list.
- Trigger the paste warning (optional but useful). Try to paste something into the Console input line with
Ctrl+V(Windows/Linux) orCmd+V(macOS). Chrome will block the paste and show a warning that says something like "Warning: Don't paste code you don't understand..." along with instructions to typeallow pasting. - Type the phrase manually. Click into the Console input line and type
allow pastingexactly as shown, using your keyboard. Do not paste it. The phrase is case-sensitive and must be typed, not pasted, for Chrome to accept it. - Press Enter. After you press Enter, Chrome removes the paste restriction for that DevTools session. You should now be able to paste normally.
- Paste your code. Use
Ctrl+VorCmd+Vagain. The text should appear in the Console input line. Press Enter to run it, or edit it first. - Repeat when needed. The allowance lasts for the current DevTools session. If you close DevTools or reload the page, you may need to type
allow pastingagain. There is no persistent setting to turn the protection off permanently.
Common Mistakes
- Trying to paste the phrase. Chrome only accepts
allow pastingwhen it is typed character by character. Pasting it will not work and may keep the warning active. - Typing it in the wrong place. The phrase must go into the Console input line, not the Elements panel, not the Sources editor, and not the address bar.
- Expecting a settings toggle. There is no checkbox in Chrome settings or DevTools settings labeled "disable paste protection." The typed phrase is the official method.
- Using a different browser. This behavior is specific to Chrome and other Chromium-based browsers may vary. If you are in Firefox or Safari, the steps are different.
- Ignoring the security warning. The protection is there because pasting unknown code can let a malicious site run commands in your browser context. Only paste code you understand and trust.
Tips
- Use Snippets for reusable code. In DevTools, open the Sources panel, then the Snippets tab. You can create a new snippet, paste your code there (Snippets does not have the same paste restriction), and run it with
Ctrl+Enter(Windows/Linux) orCmd+Enter(macOS). This is handy for repeated testing. - Keep a local file. Save your code in a
.jsfile and load it via the Sources panel or copy from the file each time. This avoids the Console paste prompt. - Type short commands. For one-liners, typing them directly is often faster than dealing with the paste flow.
- Be cautious with copied code. Even with the protection bypassed, treat any code from the internet as untrusted until you have read it.
- Check for updates. Chrome updates can change warning wording or behavior. If the phrase stops working, make sure Chrome is up to date via Settings > About Chrome.
Troubleshooting
If typing allow pasting does not remove the restriction, work through these checks in order:
- Confirm you are in the Console. The input line should show a
>prompt. If you are in the Sources editor, switch to Console. - Type it exactly. Lowercase, one space between the words, no punctuation. Press Enter after typing.
- Reload DevTools. Close DevTools and reopen it, then try again. Sometimes the session state gets stuck.
- Update Chrome. Go to Settings > About Chrome and install any pending update, then restart the browser.
- Try an Incognito window. Extensions can interfere with DevTools. Open an Incognito window (Extensions are disabled by default) and test there. If it works, disable extensions one by one to find the culprit.
- Reset DevTools settings. In DevTools, open Settings (the gear icon or
F1), go to the Preferences tab, and click Restore defaults and reload. This resets DevTools customizations but does not affect your browsing data. - Check for enterprise policy. On managed computers, administrators can enforce paste restrictions. If you are on a work or school device, contact your IT department.
If none of these work, the paste protection may be enforced by a Chrome policy or a security extension. In that case, use the Snippets workaround or run your code from a local file instead.
Frequently Asked Questions
Can I disable paste protection permanently?
No. Chrome does not provide a permanent setting to turn off the Console paste warning. The allow pasting phrase grants permission for the current DevTools session only. You will need to repeat it after closing DevTools or reloading the page.
Why does Chrome block pasting in the Console?
It is a security measure against "self-XSS" attacks, where a malicious website tricks you into pasting code that gives the attacker access to your account or data. The warning forces you to type a phrase so you consciously acknowledge the risk.
Does allow pasting work in other browsers?
This exact phrase is specific to Chrome and some Chromium-based browsers. Firefox and Safari have different Console behaviors and do not use this phrase. Always check the browser's own documentation.
Can I paste into the Console on mobile Chrome?
Mobile Chrome does not include DevTools, so there is no Console to paste into. You need a desktop browser for DevTools.
What if I accidentally pasted malicious code?
If you pasted code you do not trust, close the tab immediately without interacting further. Then clear your browser data for the site, change any passwords you used on that site, and run a malware scan. The paste protection is designed to prevent this scenario, so treat any bypass with caution.
Is there a command-line flag to disable it?
No official Chrome flag disables the Console paste protection. Do not use unofficial flags or modified builds; they can compromise security and stability.