Cookie Consent Banner Generator
Generate a self-contained GDPR-style cookie consent banner (HTML, CSS, vanilla JS) with accept, reject, and save-preferences actions.
About this tool
The Cookie Consent Banner Generator outputs a single copy-paste snippet of HTML, CSS, and dependency-free JavaScript that implements a GDPR-style consent banner. It offers Accept all, Reject non-essential, and Save preferences with per-category toggles, persists the decision in localStorage, and fires a window event so you can conditionally load analytics or marketing tags. Customise the categories, position, theme, and accent colour, then review with a professional to confirm it meets your local consent requirements.
Frequently asked questions
How do I add a cookie consent banner to my site?
Set your company name, cookie categories, position, theme, privacy policy URL, and accent colour, then copy the generated HTML/CSS/JS snippet and paste it before the closing </body> tag.
Where is the visitor's choice stored?
The choice is saved in the browser's localStorage under the key cookie_consent_v1, so the banner only shows once until the visitor clears it or you bump the key.
How do I react to the user's consent in my own scripts?
The snippet dispatches a window 'cookieConsentUpdated' event with the per-category choices as detail, and also re-emits the stored value on load, so you can gate analytics or marketing scripts on it.