Set browser cookie using JavaScript

TL;DR: execute in console to set cookie name NAME and value VALUE:

document.cookie = 'NAME=VALUE; path=/';

Did you know you can set a document cookie without a browser extension?

This is done by executing JavaScript code in the browser console.


Open the browser console:

  1. Right-click the webpage
  2. Select Inspect/Inspect Element
  3. Go to the Console panel


Given a cookie with name NAME and value VALUE, the JavaScript code will look like:

document.cookie = 'NAME=VALUE; path=/';

path=/ ensures the cookie is not limited to the current path of the document location. See options.

Paste the JavaScript code in the browser Console and hit Enter to execute it.

To see all cookies, run the following JavaScript code in the browser Console:


Please support this site and join our Discord!