Cookie Consent Banner
Generates a working consent banner - blocks tagged scripts until consent, Google Consent Mode v2, no dark patterns.
100% free. Runs entirely in your browser - your files and data never leave your device and nothing is uploaded to any server.
Template, not legal advice. This generates working code, not legal advice. It gives you a compliant mechanism; whether your site is compliant also depends on what you connect to it. Two things it cannot do for you: tag every third-party script so the blocker can hold it back, and keep a record of consents if your regulator expects one. Test it with your browser developer tools open - if a tracking cookie appears before you click Accept, something is still loading outside the blocker.
Start from an example
Fills every answer with a worked example you can edit. Pick the one closest to your business.
Other documents you can generate
Most sites need more than one. A privacy policy without terms, or terms without a refund policy, leaves the obvious gap.
About this tool
A cookie banner is the part of cookie compliance that actually does something: it stops non-essential scripts from running until a visitor agrees. Most free snippets get this backwards - they set the cookie first and show a notice second, which is exactly what the ePrivacy rules forbid. This generator outputs copy-and-paste HTML, CSS and JavaScript with Accept and Reject buttons of equal prominence and category toggles off by default, and it holds back tagged scripts until consent is given. Add it the same day you add analytics or an advertising pixel. It needs no external service or monthly fee, and your settings stay in your browser.
How to use this tool
- Set up the bannerEnter your site name, the link to your cookie policy and the consent model you need.
- Choose the categoriesPick the analytics and marketing categories to offer, all off by default.
- Install and retag scriptsPaste the code into your site and retag each tracking script so the banner can hold it back until consent.
What makes a consent banner compliant
UK and EU regulators have been consistent about a few points: non-essential cookies must not load before the visitor agrees, rejecting must be as easy as accepting, pre-ticked boxes do not count as consent, and people must be able to change their mind later. A banner with only an "OK" button, or a reject option hidden two screens deep, does not meet that standard.
The banner this page builds holds back tagged scripts until the visitor chooses, offers Accept and Reject with equal weight and stores the choice so it is not asked on every page. What it cannot do is block scripts you have not tagged - so testing with the browser developer tools open is part of the job.
Key features
- Accept and Reject buttons with equal prominence, as UK and EU guidance expects.
- Category toggles for analytics and marketing, off by default.
- Holds back tagged scripts until consent, then loads only the categories chosen.
- Copy-and-paste HTML, CSS and JavaScript with no external service or monthly fee.
Common uses
- A small business site with Google Analytics and UK or EU visitors.
- A shop running Meta or Google Ads remarketing tags.
- Replacing a paid consent platform on a site with only a few tags.
- A developer who needs a lightweight banner for a client project.
Tips for better results
- Test with developer tools open: no tracking cookie should appear before you click Accept.
- Give Reject the same size and colour as Accept - UK and EU guidance expects an equal choice.
- Link the banner to a cookie policy that uses the same category names.
Mistakes to avoid
- Installing the banner but leaving tracking scripts untagged, so pixels keep firing before consent.
- Hiding Reject behind a settings screen while Accept sits on the first layer.
- Forgetting to add new scripts to the banner when you install another tool later.
Frequently asked questions
US law generally does not require opt-in consent for cookies, though some state privacy laws require an opt-out for selling or sharing data for targeted ads. If you get UK or EU traffic, an opt-in banner is the safer choice.
Change the script type to text/plain and add a data attribute naming its category; the banner switches it back and runs it after consent. Inline scripts and tags loaded through a tag manager need the same treatment.
Yes - visitors who reject are not counted. Google Consent Mode can model some of the missing data, but expect lower numbers than before the banner.
No. It assembles a draft from standard clauses, and every page says so above the preview. The largest EU cookie fines have not been for missing banners. They were for banners where rejecting was harder than accepting, or where trackers ran regardless of the answer.
Broadly, developers and site owners who need a working consent mechanism rather than another policy page. The best time to do it is the same day you add analytics or an advertising pixel, not afterwards.
Installing the banner and leaving the tracking scripts untouched. The banner blocks nothing on its own - every script has to be retagged so the blocker can hold it back, and an untagged pixel keeps firing while the banner politely asks permission.
Most people need Cookie Policy and Privacy Policy as well. They cover the gaps this one does not.