layout | title | authors | date | updated | description | tags | |||
---|---|---|---|---|---|---|---|---|---|
layouts/doc-post.njk |
View, add, edit, and delete cookies |
|
2015-04-13 |
2023-03-16 |
Learn how to view, add, edit, and delete a page's HTTP cookies using Chrome DevTools. |
|
{% Aside 'caution' %} Your site may use third-party cookies and it's time to take action as we approach their deprecation. To learn what to do about affected cookies, see Preparing for the end of third-party cookies. {% endAside %}
HTTP Cookies are mainly used to manage user sessions, store user personalization preferences, and track user behavior. They are also the cause of all of those annoying "this page uses cookies" consent forms that you see across the web. This guide teaches you how to view, add, edit, and delete a page's cookies with Chrome DevTools.
- Open Chrome DevTools.
- Open Application > Storage > Cookies and select an origin.
{% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/3Z0YXsThDJtTmS8Z3z33.png", alt="The Cookies pane.", width="800", height="411" %}
The Cookies table contains the following fields:
- Name. The cookie's name.
- Value. The cookie's value.
- Domain. The hosts that are allowed to receive the cookie.
- Path. The URL that must exist in the requested URL in order to send the
Cookie
header. - Expires / Max-Age. The cookie's expiration date or maximum age.
For session cookies this value is always
Session
. - Size. The cookie's size, in bytes.
- HttpOnly. If true, this field indicates that the cookie should only be used over HTTP, and JavaScript modification is not allowed.
- Secure. If true, this field indicates that the cookie can only be sent to the server over a secure, HTTPS connection.
- SameSite. Contains
Strict
orLax
if the cookie is using the experimentalSameSite
attribute. - Partition Key. For cookies with independent partition state, the partition key is the site of the top-level URL the browser was visiting at the start of the request to the endpoint that set the cookie.
- Priority. Contains
Low
,Medium
(default), orHigh
if using deprecated cookie Priority attribute.
To view a cookie's value, select it in the table. To see the value without percent-encoding, check {% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/hmp8j3HiLMCcqPArD9yt.svg", alt="Checkbox.", width="22", height="22" %} Show URL-decoded.
Use the Filter text box to filter cookies by Name or Value.
{% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/GjLhR30VavG3SLYLAesv.png", alt="Filtering out any cookies that don't contain 'id'.", width="800", height="380" %}
Filtering by other fields is not supported. Filter is case-insensitive.
To add an arbitrary cookie:
- Double-click an empty row in the table.
- Enter a Name and Value and press Enter.
{% Video src="video/NJdAV9UgKuN8AhoaPBquL7giZQo1/Q9Gj9s3fU8yJU8U8UfBK.mp4", autoplay="false", muted="true", loop="false", controls="true", class="screenshot" %}
DevTools populates other required fields automatically. You can edit them as described next.
All the fields are editable except Size that updates automatically.
Double-click a field to edit it.
{% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/YqXUSqxkehuVCTNeSp7i.png", alt="Setting the name of a cookie to 'DEVTOOLS!'", width="800", height="424" %}
DevTools highlights cookies with invalid field values in red.
{% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/UGLmEZHAzssqmpk28IgO.png", alt="A cookie with an invalid in Partition Key value.", width="800", height="424" %}
To filter out valid cookies, check {% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/hmp8j3HiLMCcqPArD9yt.svg", alt="Checkbox.", width="22", height="22" %} Only show cookies with an issue in the top action bar.
To delete a cookie, select it and click {% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/w9Vbnqf9cVz7YeqMkAi0.svg", alt="Delete selected.", width="24", height="24" %} Delete selected in the top action bar.
{% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/G1jzKCU0oMOxxB03i1q9.png", alt="Deleting a selected cookie.", width="800", height="424" %}
Click {% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/MadqZsIZpo1sj3qQ3GsZ.svg", alt="Clear.", width="24", height="24" %} Clear all to delete all cookies.
{% Img src="image/NJdAV9UgKuN8AhoaPBquL7giZQo1/fptz4uhHm8YevOpm4SGK.png", alt="Clearing all cookies.", width="800", height="424" %}