Website Tools

Cookie Banner Generator

Get a self-hosted cookie consent banner without a third-party service. Choose the categories you use – preferences, analytics, marketing – the position and theme, and how long to remember the choice. The banner offers “Accept all” and “Reject all” with equal prominence plus detailed settings, stores the choice and date in a first-party cookie, runs scripts marked type="text/plain" only after consent, fires a cookieconsent event and can send Google Consent Mode v2 updates.

  • Runs in your browser
  • No sign-up
  • Free to use
Start from an example
days

    How to use Cookie Banner Generator

    1. Choose categories, text and cookie policy link.
    2. Pick position, theme and colour.
    3. Copy the HTML, CSS and JavaScript.
    4. Change optional scripts to type="text/plain" with a category.

    Cookie Banner Generator features

    Real script blocking

    Optional scripts run only after consent.

    Equal choices

    Accept and reject side by side.

    Consent Mode v2

    Optional gtag updates.

    Settings link

    Reopen and change choices.

    Live preview

    See the result in a sandboxed frame as you type.

    No third party

    Self-hosted, no external requests.

    When to use Cookie Banner Generator

    • Small business and blog websites.
    • Shops with analytics and ads.
    • Agencies building client sites.
    • Developers replacing heavy consent plugins.

    Cookie Banner Generator FAQ

    Is this banner GDPR compliant?

    It follows the main requirements (prior consent, equal reject option, granular choices, easy withdrawal, record of consent), but compliance depends on how you use it – it is a technical template, not legal advice.

    Does it block cookies automatically?

    It blocks scripts you mark with type="text/plain" and data-cc-category. Scripts left unchanged still run, so update every optional tag.

    What is Google Consent Mode?

    A way to tell Google tags whether consent was given, so they adjust their behaviour. Add the default “denied” call before the Google tag.

    Consent done properly

    Regulators fine banners that make rejecting harder than accepting or that set cookies before a choice. This banner avoids both patterns by design.

    How it works: you fill in plain text fields and lists, and the generator writes clean, indented HTML and CSS in your browser. Everything you type is escaped before it is placed in the markup, links are checked so that javascript: and data: URLs cannot slip in, and the preview runs in a sandboxed frame without scripts. Nothing is uploaded or stored.

    The code has no framework or build step: copy the HTML into a page, template or page-builder HTML block, and the CSS into your stylesheet. Class names use a prefix you choose (BEM style), so they do not clash with your theme, and colours come from your accent colour with automatic contrast checks.

    Accessibility is built in: semantic landmarks and headings, real labels on form fields, visible focus outlines, enough colour contrast and layouts that reflow on small screens without horizontal scrolling. The notes under the output explain the decisions and what you still need to do on your side.

    Other useful tools