GDPR & ePrivacy
What counts as a strictly necessary cookie?
A cookie is strictly necessary only if the service the visitor asked for can't work without it. Login sessions, carts and security tokens usually qualify; analytics and advertising usually don't.
- Plain English
- Written for website owners
- Free to read
On this page
A strictly necessary cookie is one without which a service the visitor explicitly asked for can't be delivered. Under Article 5(3) of the ePrivacy Directive, these cookies don't need consent. Typical examples are a login session cookie, a shopping cart cookie, a security token on a form, and the cookie that stores the visitor's consent choice. Analytics, advertising, social media tracking and most personalization are not strictly necessary, even if your business depends on them.
The test regulators apply
The exemption comes from the second half of Article 5(3): storage or access that is "strictly necessary in order for the provider of an information society service explicitly requested by the subscriber or user to provide the service". The Article 29 Working Party's Opinion 04/2012 (WP194) is still the main interpretation, and national regulators have built on it. It boils down to two questions:
- Did the visitor explicitly request the service? The service is judged from the visitor's point of view: logging in, adding items to a cart, paying, submitting a form, playing a video they clicked. Your business goals, such as measuring traffic or retargeting, are not services the visitor requested.
- Is the cookie strictly needed to provide it? If the feature would still work without the cookie, or could reasonably work another way, the cookie isn't strictly necessary. "Useful", "standard" or "industry practice" don't meet the bar.
WP194 also points to two further factors: the purpose of each cookie should be assessed separately, and its lifetime should match its purpose. A cart cookie that lasts for years, or a login cookie that also tracks reading habits, stretches the exemption past what it covers.
Usually exempt: examples
| Cookie or storage | Why it's usually exempt | Watch out for |
|---|---|---|
| Login / session ID | Keeps the visitor authenticated after they chose to sign in | Long-lived "remember me" cookies are an extra feature; tie them to an explicit choice |
| Shopping cart | Remembers what the visitor added to their basket | Using the cart cookie for abandoned-cart marketing changes its purpose |
| CSRF token | Protects forms the visitor submits against cross-site request forgery | Fine as long as it's used only for security |
| Security cookies | Detect repeated failed logins or protect the login process | WP194 accepts longer lifetimes here; keep the purpose narrow |
| Load balancing | Routes the visitor's requests to the same server so the session works | Keep it session-length and free of identifiers used elsewhere |
| Consent preference | Remembers the visitor's cookie choice so you don't ask on every page | Store only the choice and a random ID, not a profile |
| Payment and checkout | Needed by a payment provider to complete the transaction the visitor started | Check what else the provider's script sets, and on which pages |
| Language or region the visitor picked | Remembers a setting the visitor explicitly chose in the interface | Short lifetimes are safer; some regulators treat long-lived preferences as functional |
Usually not exempt: examples
- Analytics and audience measurement. Your site works without them. Some regulators allow an exemption for limited, first-party audience measurement under strict conditions (France's CNIL is the best-known example), and the UK has added an analytics exception with conditions. Standard setups of mainstream analytics tools typically don't qualify. See cookieless analytics for the nuances.
- Advertising, retargeting and conversion tracking. Including pixels from ad platforms and affiliate cookies.
- Social media plugins that track visitors who haven't interacted with them.
- A/B testing and personalization the visitor didn't ask for.
- Session recording and heatmaps.
- Embedded videos and maps before the visitor chooses to play or load them.
- Chat widgets that set tracking cookies on page load, before the visitor opens a chat.
Our guide to cookie categories shows where each of these usually goes instead.
Edge cases, one by one
Load balancing
A cookie that pins a visitor to one server so their session survives is a standard example of an exempt cookie in WP194. The exemption covers the routing, not anything else the same cookie might be used for. If your CDN or host sets a load-balancing cookie, check its lifetime: a session cookie is the clean case.
CSRF tokens and other security tokens
Anti-forgery tokens protect actions the visitor takes, like submitting a form or changing an account setting. They're needed to deliver that action safely, so they're generally treated as exempt. The same goes for cookies that limit brute-force login attempts.
Bot detection is murkier. A first-party mechanism that protects your own forms is easy to justify. A third-party service that also collects data for its own purposes is harder, and regulators haven't spoken with one voice. If you rely on one, read what it sets and why, and document your reasoning.
Shopping carts
A cart cookie is exempt for its job: remembering items the visitor added. Persisting the cart for weeks is a convenience rather than a strict need, so keep the lifetime reasonable. If the same identifier feeds email reminders or ad audiences, that use needs consent.
The consent cookie itself
You need to remember whether someone accepted or refused, otherwise you'd ask on every page or, worse, guess. Regulators accept storing that choice without consent. Keep it minimal: the choice, a version and a random ID that links to your consent record. Don't use it to recognize returning visitors for other purposes.
Analytics
This is the most common misclassification. Knowing how many people visit is valuable to you, but it isn't a service the visitor requested, so analytics cookies are not strictly necessary under the general rule. A few jurisdictions have created narrow, conditional exceptions for audience measurement. Where they exist, they usually require first-party, aggregated statistics, no cross-site tracking, no sharing for the vendor's own purposes, limited cookie lifetimes and a way to object. Check the rules of each country where you rely on such an exception; see CNIL's audience measurement rules and the UK's new exceptions.
Embedded content the visitor clicks
A video or map that the visitor chooses to load is a service they requested. But the cookies a third-party embed sets often go beyond playing the video: they can also serve the provider's own analytics, advertising or personalization. Those extra purposes aren't strictly necessary for playback. That's why the common approach is a click-to-load placeholder that tells the visitor which provider will set cookies, and loads the embed only when they agree. "Privacy-enhanced" embed modes reduce what's stored but don't always remove it; see YouTube embeds and cookies for an example.
Third-party "necessary" scripts
Some vendors label all their cookies "necessary". That label is the vendor's opinion, not a legal classification. A fraud-prevention cookie on your checkout page may well be necessary there; the same script loaded on every page of your blog is harder to justify.
How to classify your own cookies
- Start from a real inventory. Scan your site and note every cookie and storage key, who sets it, its lifetime and the pages it appears on. Our cookie audit guide covers the columns.
- Name the visitor-requested service. For each item, write the feature it supports in the visitor's words: "keeps me logged in", "remembers my cart". If you can't, it's probably not necessary.
- Ask whether the feature breaks without it. Try it, if you can. Disable the cookie in a test environment and see what happens.
- Check purpose creep. Make sure the cookie isn't also used for analytics, marketing or profiling.
- Check the lifetime. Shorten it if it outlives its purpose.
- Write down your reasoning. A one-line justification per cookie is enough, and it's what you'd show a regulator.
When in doubt, put it in a consent category. Wrongly asking for consent costs you a little data; wrongly claiming the exemption is a breach of the law.
What exempt doesn't mean
The exemption removes the need for consent. It doesn't remove other duties:
- Transparency. If the cookie involves personal data, the GDPR's information duties (Arts. 13 and 14) still apply. In practice, list necessary cookies in your cookie policy with their purpose and lifetime.
- A legal basis for the processing. Any personal data processed through the cookie still needs a GDPR Art. 6 basis, typically contract or legitimate interest for necessary cookies.
- Security and minimization. Set sensible attributes such as
Secure,HttpOnlyandSameSite, and don't store more than you need.
Specific cases: Cloudflare cookies, Stripe and PayPal cookies and Google reCAPTCHA.
Next steps
- Run a free scan to see what your site sets before consent.
- Apply the two-question test to every item marked "necessary", including ones your vendors labeled.
- Move anything that fails into analytics, functional or marketing, and block it until consent. In PrivacyQuick, strictly necessary scripts are left alone and everything else waits for its category; see the script blocking docs.
- Update your cookie policy so necessary cookies are listed with a plain-language reason.
Frequently asked questions
Do strictly necessary cookies need consent?
No. They're exempt from the consent requirement in Article 5(3) of the ePrivacy Directive. You should still tell visitors about them, usually in your cookie policy.
Are Google Analytics cookies strictly necessary?
No. Regulators treat standard analytics as not strictly necessary because the service the visitor requested works without it. Some countries allow narrow exemptions for privacy-friendly audience measurement, under strict conditions.
Can a third-party cookie be strictly necessary?
Yes, if it's genuinely needed to deliver what the visitor asked for, for example a payment provider's cookie during checkout. Being third party doesn't disqualify a cookie, but most third-party cookies are set for other purposes.
Can visitors turn off strictly necessary cookies in a banner?
Banners normally show them as always active, because the site can't work without them. Visitors can still block them in their browser, which may break features like login or checkout.
Check your own website in 30 seconds
Our free scanner lists every cookie and tracker your site sets, sorted into categories, before you add a banner.
This guide is general information, not legal advice. Laws and regulator guidance change; check the current rules for your situation or ask a lawyer.