EN
My tools

Cookie Consent Banner Generator (GDPR, Consent Mode v2)

Generate a self-contained cookie consent banner: equal Accept and Reject buttons, categories, a saved choice with expiry, script blocking and Google Consent Mode v2.

Head snippet
Banner snippet (before </body>)
Footer link and script blocking
Buttons
Reject all · Choose · Accept all (same size and colour)
Categories asked
analytics, marketing
Consent Mode defaults
ad_storage, ad_user_data, ad_personalization, analytics_storage: denied
Choice stored
localStorage "cookie_consent", 180 days

This banner helps you ask for consent; it does not make a site compliant by itself. You must also keep non-essential scripts from running before consent (Consent Mode for Google tags, the text/plain pattern for others), describe the cookies in a policy and keep the record of choices. Not legal advice.

For Google AdSense, Ad Manager or AdMob ads to visitors in the EEA, the UK and Switzerland, Google requires a Google-certified consent management platform that supports the IAB TCF. Use such a CMP instead of this banner for those ads.

My tools →
Advertisement

In the EU, the UK and many other places, a site must ask before setting analytics or advertising cookies, and refusing must be as easy as accepting. This generator writes a small, dependency-free cookie banner: Accept all, Reject all and Choose buttons of equal weight, category switches, a saved choice that expires, a footer link to reopen it, a pattern for blocking other scripts until consent, and Google Consent Mode v2 signals for Analytics and Ads tags.

How to use this tool

  1. Pick a layout, write the heading and message, and link your cookie policy.
  2. Choose which categories to ask about and set the colours.
  3. Paste the head snippet before any Google tag and the banner snippet before </body>.
  4. Add the "Cookie settings" footer link and change other tracking scripts to type="text/plain" with a data-cookie-category.

Formula

Before consent: gtag('consent', 'default', { ad_storage, ad_user_data, ad_personalization, analytics_storage: 'denied' }). After a choice: gtag('consent', 'update', …) with 'granted' only for accepted categories, and blocked scripts are re-inserted as real scripts.

The choice is saved in localStorage as {v, analytics, marketing, date, expires} and read again in the head on later visits, so Google tags start with the right state. Withdrawing a category reloads the page so scripts that already ran stop.

Example

With the defaults, the banner asks about analytics and marketing, shows Reject all · Choose · Accept all in the same colour and size, sets all four Consent Mode v2 signals to denied by default, and remembers the choice for 180 days.

Frequently asked questions

Is this enough for GDPR?

It covers the mechanics regulators look for — prior opt-in, equal reject, granular choice, easy withdrawal — but compliance also depends on what your site loads, your cookie policy and records. Have it reviewed, and note that Google requires a certified CMP for its ad products in the EEA, UK and Switzerland.

What does Consent Mode v2 do?

It tells Google tags whether they may use cookies (ad_storage, analytics_storage) and whether data may be used for ads (ad_user_data, ad_personalization). With denied, tags send cookieless pings or nothing, depending on your setup.

How long should a choice be remembered?

Many regulators consider about six months reasonable before asking again; the default here is 180 days. Never keep it longer than 13 months.

Sources

This result is an estimate for general information only, not financial, tax, legal or medical advice. Rules and rates change and your circumstances may differ, so confirm with the official source or a qualified professional before you rely on it. You use the result at your own risk. How we check our calculators · Full disclaimer

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). Cookie Consent Banner Generator (GDPR, Consent Mode v2). https://kakao.mobile/tools/gdpr-cookie-banner-generator/

MLA

“Cookie Consent Banner Generator (GDPR, Consent Mode v2).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/gdpr-cookie-banner-generator/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement