How to copy cookies in Google Chrome?
Google ChromeCookiesGoogle Chrome Problem Overview
Is there any way I can copy/edit the cookies in Chrome Developer tools? Or do I need to install a custom add-on for this?
Google Chrome Solutions
Solution 1 - Google Chrome
I think I have found something. I can press Ctrl+A and Drag & Drop the values in a TextBox and then copy it from there.
As pointed by @jmccure,
Ctrl+A, hold Shift and right click and copy.
Update: Chrome 58 added a support to edit cookies
Solution 2 - Google Chrome
Cross-browser Solution:
- Hit F12 or Right-click page and Inspect to open the Developer Tools
- Click the Application Tab (which used to be called Resources)
- Open Cookies on the left, select your site/domain
- Double-click cookie column Value
- CTRL/Command + C or Right-click and select Copy
Solution 3 - Google Chrome
If you have a lot of cookies and you don't want to install any plugin, I created a small script to avoid copying the cookies one by one.
It was tested only in Google Chrome.
// Open the console in the developer tools
// Tab where you are getting the cookies from
// This block can be just copy and paste
let cookies = document.cookie;
cookies = cookies.split(";");
cookies = cookies.map(cookie => cookie.replace(" ", ""));
copy(cookies);
// Tab where you want to have the cookies
// This block cannot be copy and paste since there is no function to paste
const newCookies = // paste your cookies array here
newCookies.map(newCookie => {
document.cookie = newCookie;
})
Solution 4 - Google Chrome
An alternative approach to copy a long cookie value:
- Repeat the request with the Network tab open.
- Right-click the relevant request (in the list on the left-hand side).
- Choose Copy as cURL.
- Extract the cookie from the generated
Cookie
header option.
For example: curl 'http://...' -H 'Cookie: session=...' ...
Solution 5 - Google Chrome
This sounds strange, but if you hold Shift and right click, it seems to work most of the time.
Solution 6 - Google Chrome
I use the Edit this Cookie extension for Google Chrome, which is very nice.
According to its documentation:
> EditThisCookie is a cookie manager. You can add, delete, edit, search, > protect and block cookies!
Solution 7 - Google Chrome
You have to select the value and then you can copy it. Double click helps, but if there are some delimiter characters (e.g. ".", "-" etc.) then you have to triple click it (at least in Windows 10).
So basically:
- select the value (double or triple click)
- copy the selection (Ctrl+C or "Copy" from context menu)
Solution 8 - Google Chrome
Unfortunately, there doesn't seem to be any reliable way to do this from developer tools. Right clicking the value and choosing copy sometimes works, but not if there are delimeter characters.
One workaround is to go into the js console and print document.cookie
. Unfortunately, that only works for non HTTP_Only cookies.
Solution 9 - Google Chrome
Another combination that works: Click on cookie value. While holding the left mouse button, click right button thrice. The Copy command will now appear in the shortcut menu.