GDPR Cookie Consent Generator

Generate a customizable cookie consent banner for your website. Compliant with GDPR and ePrivacy directive.

  1. Home
  2. Web Dev
  3. Cookie Consent Generator

What is a GDPR Cookie Consent Banner?

A cookie consent banner is a notification that appears on websites to inform visitors about the use of cookies and obtain their consent as required by the EU General Data Protection Regulation (GDPR) and the ePrivacy Directive. It must allow users to accept or reject non-essential cookies.

This generator creates a customizable, accessible cookie consent banner that you can easily integrate into any website. The generated code is self-contained (HTML + CSS + JavaScript) and does not rely on external dependencies. It supports multiple positions, color themes, and includes built-in cookie management with a configurable expiration period.

How to Use

  1. Choose Position — Select where the banner should appear: top, bottom, corner, or center modal.
  2. Pick a Theme — Choose from preset themes (Light, Dark, Blue, Green) or select Custom to set your own colors.
  3. Customize Text — Edit the banner message, accept/decline button text, and add your privacy policy URL.
  4. Switch Code Tabs — View the generated HTML, CSS, and JavaScript separately by clicking the tabs above the output.
  5. Copy or Download — Copy individual sections or download the complete HTML file. Add the code to your website before the closing </body> tag.

Frequently Asked Questions

Is this banner GDPR compliant?

The generated banner provides the basic requirements for GDPR compliance: informed consent with accept/decline options, a link to your privacy policy, and the ability to withdraw consent. For full compliance, consult with a legal professional and ensure your cookie management practices meet all applicable regulations.

How does the cookie consent work?

When a user clicks "Accept," a cookie named cookie_consent is stored in their browser with a value of accepted. When they click "Decline," the cookie is set to declined. On subsequent visits, the banner checks for this cookie and only shows if no consent cookie exists or if it has expired.

Can I use this with Google Analytics or third-party scripts?

Yes. The generated banner sets a cookie that you can check before loading third-party scripts. Add a check for getCookie('cookie_consent') === 'accepted' before initializing analytics, tracking pixels, or other non-essential cookies. This is the recommended approach for GDPR compliance.

Apakah data saya disimpan?

No. Semua proses terjadi di browser Anda. Data tidak pernah dikirim ke server.