Websites from ₹4,999 · Apps from ₹24,999 · 100 free tools

Free tool · Developer tools

Cookie Consent Banner Generator

Create a lightweight cookie notice for your website with this cookie consent banner generator: Accept, Reject and Settings buttons, your colours and a copy-paste snippet that blocks optional scripts until visitors agree.

Live preview

The preview uses the same HTML and CSS as your snippet. Buttons here do not save anything.

How to use it
  1. Paste the code just before </body> on every page (on WordPress, use your theme's footer or a "header and footer code" plugin).
  2. Change each optional script so it does not run until the visitor agrees. Set its type to text/plain and add data-consent="analytics" or data-consent="marketing":
    <script type="text/plain" data-consent="analytics" src="https://www.googletagmanager.com/gtag/js?id=G-XXXX"></script>
  3. The banner turns those scripts on only after the visitor accepts that category. The choice is saved in the browser for 180 days.
  4. Add a link so visitors can change their mind, for example in your footer: <a href="#" onclick="cookieConsent.show();return false">Cookie settings</a>
  5. In your own code you can check cookieConsent.allowed('analytics'), or listen for the cookieconsent event on document.

Not legal advice. This is a starting template. Which rules apply depends on your site and visitors, for example India's Digital Personal Data Protection Act, 2023 (DPDP Act) or the GDPR for visitors in the EU. Check with a qualified professional, and make sure your privacy policy matches what your site really does. Scripts that are not marked as above will still run without consent.

Everything runs in your browser. Nothing you type is sent anywhere, and it is cleared when you close this page.

Free · no sign-up · runs in your browser, nothing is uploaded

Need help fixing it?

Get a free website audit from our team

Our developers check your site's speed, SEO and mobile experience and send you a short list of fixes. No charge, no obligation.

  • Reply on WhatsApp or call, your choice
  • Websites from ₹4,999, apps from ₹24,999

Request free audit

We reply within a few working hours. No spam.

A simple cookie banner you fully control

Many websites use analytics, advertising pixels or chat widgets that set cookies. Depending on where your visitors are and what your site does, laws may expect you to tell visitors about these cookies and, in some cases, ask for their consent before optional ones are used. Ready-made consent services are often paid, load extra scripts or send data to another company. This cookie consent banner generator gives you a small, self-contained snippet instead: plain HTML, CSS and JavaScript that make no external requests.

How to use the cookie consent banner generator

  1. Write your message and add the link to your privacy policy.
  2. Set the button texts. Tick Settings to let visitors choose Analytics and Marketing separately.
  3. Choose the position (bottom bar, bottom-left box or centre pop-up), your colours and the text size. The live preview updates as you go.
  4. Copy the code and paste it just before the closing </body> tag on every page.
  5. Change each optional script so it waits for consent: set type="text/plain" and add data-consent="analytics" or data-consent="marketing".

How the snippet works

On the first visit the banner appears. Scripts marked for a category stay switched off until the visitor accepts that category. The choice is saved in the visitor’s browser (localStorage, with a cookie as a backup) for 180 days, after which the banner asks again. Your own code can check cookieConsent.allowed('analytics'), listen for the cookieconsent event, or reopen the banner with cookieConsent.show(), for example from a “Cookie settings” link in your footer. If a visitor withdraws a choice, the page reloads so the scripts stop.

The snippet cannot control scripts you did not mark, cookies set by your server, or third-party embeds such as YouTube videos. Review everything your site loads.

Not legal advice

This is a starting template, not legal advice. Which rules apply depends on your website, your business and your visitors, for example India’s Digital Personal Data Protection Act, 2023, or the GDPR for visitors in the European Union. Make sure your privacy policy describes what your site really does, and ask a qualified professional if you are unsure. Our privacy policy generator can help you draft one.

The banner is built in your browser. Nothing you enter is sent to our server.

FAQ

Cookie Consent Banner Generator: FAQs

Does this banner make my website legally compliant?

No tool can promise that. The banner is a starting template that blocks marked scripts until consent. Whether it meets the rules for your site depends on what you use and who visits, so check with a qualified professional.

How do I stop Google Analytics until a visitor accepts?

Change the Google tag scripts to type="text/plain" and add data-consent="analytics" to each of them. The banner switches them on only after the visitor accepts analytics.

How long is the choice remembered?

For 180 days. The choice is stored in the visitor's browser, in localStorage with a cookie as a backup. After that, or if the visitor clears their browser data, the banner appears again.

Can visitors change their mind later?

Yes. Add a link that calls cookieConsent.show(), for example "Cookie settings" in your footer. If they withdraw a choice, the page reloads so the scripts stop running.

Does the snippet load anything from other websites?

No. It is plain HTML, CSS and JavaScript with no external files, fonts or tracking.

More free tools

You might also like

New

XML Sitemap Generator

Use this XML sitemap generator to crawl a small website (up to 100 pages), skip pages blocked by robots.txt or noindex, and…

SEO tools

See all free tools

Have a project in mind?

Tell us what you want to build. You get ideas, a timeline and a clear quote, free.

Chat on WhatsApp