Cookie Consent Banner Generator

Generate a self-contained HTML, CSS and JavaScript cookie banner with accept all, reject all and choose categories. Choices are stored in localStorage, and you must block scripts yourself.

Use the tool

Why this tool exists

Many small sites need a simple consent banner without paying for or loading a large third-party script. A banner is only half the job, though: scripts that set tracking cookies must not run until the visitor agrees, and rejecting must be as easy as accepting.

This tool outputs one snippet you paste into your page. You set the title, message, policy link, optional analytics and marketing categories, position and theme. The code records the visitor's choice in localStorage under a fixed key. It does not block anything by itself, so you must read that stored choice and only load analytics or marketing scripts when allowed. It is a technical starting point and not legal advice. The snippet is generated locally in your browser.

How to use it

  1. Edit the banner title and message, and add the link to your cookie policy.
  2. Tick the analytics and marketing categories you use, and choose the position and theme.
  3. Run the tool and copy the generated code into your site.
  4. Change your scripts so they only load after the stored consent allows them.

Frequently asked questions

Does the banner block tracking scripts?

No. It only records the choice in localStorage. You must write the code that checks the choice and delays analytics, advertising and other scripts until consent is given.

Where is the visitor's choice stored?

In the browser localStorage under the key cookie-consent-v1. It stays on the visitor's device. If you need proof of consent on a server, add your own logging.

Is this enough to comply with GDPR?

Not by itself. Compliance depends on your cookies, wording and behaviour. The tool is not legal advice, so have your set-up reviewed against the rules that apply to you.

Is the code generated on a server?

No. The code is built in your browser from your settings, and nothing is uploaded, so you can generate it for private or staging projects without sharing anything.