Website Privacy and Cookie Consent Banner Generator (GDPR, CCPA)
Write the banner text, set categories and colours, test it in the live preview, then paste one snippet into your site and mark tracking scripts with data-category.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Write the text
Title, message, buttons and policy link.
- 2Set categories
Necessary, analytics, marketing or your own.
- 3Style and options
Position, colours, duration, Consent Mode, GPC.
- 4Test
Use the live preview and reset it.
- 5Install
Paste the code and mark scripts with data-category.
About this tool
If your website uses analytics, advertising pixels, embedded videos or other non-essential cookies, the EU and UK ePrivacy rules and the GDPR require visitors' prior consent, and the European Data Protection Board says consent must be freely given, specific, informed and as easy to refuse as to give. In California and other US states, people must be able to opt out of the sale or sharing of their data, and the Global Privacy Control browser signal is increasingly expected to be honoured. Commercial consent platforms do this well but charge monthly fees once traffic grows. This generator gives you a lightweight banner you own. Write the title, message and button labels, link your privacy policy, and define categories such as Strictly necessary (always on), Analytics and Marketing. The banner shows Accept all and Reject all with equal prominence on the first screen and a Choose option with per-category switches. Your tracking scripts stay inactive until consent: you change their type to text/plain and add data-category, and the code activates them only for accepted categories; embedded iframes can wait the same way. The choice is stored in a first-party cookie for the number of days you set, a policy version number lets you ask again after changes, Google Consent Mode v2 signals (analytics_storage, ad_storage, ad_user_data, ad_personalization) are sent, and a footer link reopens the settings.
Who it is for
Small business and blog owners, freelance web developers and agencies who need a simple, transparent banner without a subscription.
What the code does
| Feature | Detail | |---|---| | Prior blocking | Scripts with type="text/plain" and data-category run only after consent | | Equal choices | Accept all and Reject all on the first layer | | Granular consent | Per-category switches under Choose | | Proof of choice | Cookie with categories, timestamp and policy version | | Re-consent | Raise the version number to ask everyone again | | Google Consent Mode v2 | Default denied, updated when the visitor chooses | | GPC | When the browser sends Global Privacy Control, marketing stays off | | Accessibility | Dialog role, keyboard-reachable buttons at least 44 pixels high |
Installation
1. Paste the snippet before the closing body tag on every page. 2. Change each tracking script to `type="text/plain" data-category="analytics"` (or marketing). 3. For YouTube or maps embeds, use `data-src` instead of `src` with a data-category. 4. Add a "Cookie settings" link that calls `cookieConsent.open()`. 5. Test: reject everything and check in your browser's developer tools that no tracking requests are sent.
What it does not do
It does not scan your site for cookies, write your cookie policy, or keep a server-side consent log. Large sites, or sites using IAB TCF advertising frameworks, may need a certified consent management platform.
Worked example
A shop with Google Analytics and a Meta pixel sets three categories. In the preview, both test scripts stay "blocked" until Accept all is pressed; Reject all leaves them blocked, and the footer link reopens the settings.
Limits
This tool provides the technical mechanism; it is not legal advice. Check the rules that apply to your audience.
Worked example
3 categories; analytics and marketing scripts blocked until accepted; Consent Mode v2 on.
Quick facts
- Category: Developer & Data
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in English.
- Content last reviewed:
- Official source: EDPB Guidelines 05/2020 on consent under Regulation 2016/679
Frequently asked questions
Do I need a cookie banner?
If you use non-essential cookies for EU or UK visitors, prior consent is required.
Does the banner block cookies before consent?
Yes, scripts marked with data-category only run after consent.
Must there be a Reject all button?
Regulators expect refusing to be as easy as accepting, so it is on the first layer.
Does it support Google Consent Mode v2?
Yes, it sets defaults and updates all four consent signals.
How do visitors change their choice?
Through a footer link that calls cookieConsent.open().
Is this legal advice?
No, it is a technical tool; check the rules that apply to you.
