Cookies & tracking
Cookie banner design best practices that stay compliant
A well-designed cookie banner is easy to read, gives Accept and Reject the same visual weight, fits your brand without nudging, works on a small screen and doesn't shift the page. Here's how to make each layout and styling decision with the regulators' expectations in mind.
- Plain English
- Written for website owners
- Free to read
On this page
- The rules that shape banner design
- Choose a layout: bar, box or modal
- Give Accept and Reject equal weight
- Decide what goes on the first layer
- Design for mobile first
- Avoid layout shift and slow loading
- Fit your brand without nudging
- Test before and after launch
- Design review checklist
- Frequently asked questions
A compliant cookie banner design comes down to three things: visitors notice it, they understand it, and refusing is exactly as easy as accepting. Within those limits you have a lot of freedom. You can choose a bottom bar, a corner box or a centered dialog, use your own fonts and colors, and keep the banner light enough that it doesn't hurt page speed. This guide goes through each design decision and the rules that shape it, then finishes with a checklist you can use in a design review.
The rules that shape banner design
Most design constraints come from the GDPR's consent standard. Consent must be freely given, specific, informed and unambiguous (Art. 4(11)), the controller must be able to prove it (Art. 7(1)), and withdrawing must be as easy as giving it (Art. 7(3)). The ePrivacy Directive, Art. 5(3), applies that standard to cookies and similar technologies.
European regulators have turned those principles into fairly concrete design expectations. The EDPB cookie banner taskforce report (January 2023) addressed missing reject buttons, reject links buried in text, and colors or contrast that make refusal look unavailable. France's CNIL, covered in our guide to the CNIL's cookie rules, expects refusing to be as easy as accepting, and the UK ICO has made similar points. Our article on cookie banner dark patterns goes through the taskforce findings one by one. This guide focuses on the positive side: what to design instead.
US state laws mostly don't require a consent banner, but if you use one, California's regulations require symmetry in choice and ban confusing designs (Cal. Code Regs. tit. 11, §7004). The same design habits serve both.
Choose a layout: bar, box or modal
There's no legally required position. Each layout has trade-offs:
| Layout | Strengths | Watch out for |
|---|---|---|
| Bottom bar (full width) | Familiar, leaves the main content readable, room for buttons side by side on desktop | Easy to ignore; on mobile it can cover a large share of the screen and hide focused elements |
| Corner box | Compact, feels less intrusive, works well with short text | Small type, cramped buttons; three buttons may not fit side by side |
| Centered dialog (modal) | Hard to miss, clear focus for keyboard and screen reader users | Blocks the page, so the reject option must be just as prominent; can feel like a wall if refusal isn't obvious |
| Top bar | Visible on load | Easy to cause layout shift if inserted above the content instead of overlaying it |
Whatever you choose, the banner should appear on the first page a visitor lands on, not only on the home page, and it should stay until they make a choice. Treat closing with an X as "no consent", not as acceptance. A blocking dialog is acceptable when Reject all is right there; making access depend on accepting is a different matter, covered in are cookie walls legal?
Give Accept and Reject equal weight
This is the single most important design decision. "Equal weight" means the reject option matches the accept option in every visual property that affects how likely someone is to click it:
- Same element type. Two buttons, not a button and a text link.
- Same size, font size and font weight. A bold, wide Accept beside a small Reject is a nudge.
- Same style. Both filled or both outlined. If one is in your brand color, make both the brand color.
- Readable contrast for both. A pale gray Reject on a white background can look disabled.
- Same layer. If Accept all is on the first layer, Reject all is on the first layer.
- Same number of clicks. One click to accept everything, one click to refuse everything.
Order matters less than style, but put the buttons side by side on desktop and stack them at equal width on mobile. The third button, Preferences or Customize, can be visually secondary, because it's a route to more detail rather than a final answer.
The second layer needs the same discipline. Every optional category starts switched off, there's a Reject all next to Accept all, and "Save choices" saves exactly what the switches show.
Decide what goes on the first layer
A good first layer reads in a few seconds. Aim for a short heading, two to four sentences of text, the three buttons, and a link to the cookie policy. The text should name the purposes in plain words, mention third parties if you use them, and say how to change the choice later. Our cookie banner text examples give ready-to-edit wording.
Use visual hierarchy to make reading easy, not to steer the answer:
- A clear heading such as "Cookie settings" or "Your privacy choices".
- Body text at the same size as your site's body text, not tiny print.
- The cookie policy link styled as a link, separate from the buttons.
- No logos, illustrations or animations that push the buttons out of view.
Detail belongs in the preference center: category descriptions, the list of services, cookie names and lifetimes. Layering is the standard way to be both brief and complete.
Design for mobile first
Many visitors will see your banner on a phone first, where space problems are worst. Check these points on a real device:
- All buttons visible without scrolling the banner. If the text is so long that Reject all ends up below the fold of the banner while Accept all is visible, you've created an asymmetry by accident.
- Stacked buttons at equal width. Three full-width buttons are easier to tap than three cramped ones in a row.
- Comfortable tap targets. Give buttons enough height and spacing that a thumb doesn't hit the wrong one.
- Not covering the whole screen unless it's an intentional modal. A bar that takes up most of the viewport is a modal in all but name, without a modal's accessibility benefits.
- Works in landscape and at large text sizes. Visitors who enlarge text in their phone settings should still reach every button.
Accessibility overlaps heavily with good mobile design; our guide to cookie banner accessibility covers keyboard access, focus, contrast and zoom in detail.
Avoid layout shift and slow loading
A banner can hurt Core Web Vitals in two common ways. The first is Cumulative Layout Shift (CLS): a banner inserted into the normal page flow, typically at the top, pushes the content down after it has rendered. Google treats a CLS of 0.1 or less as good, and a late-arriving top bar can use up that budget on its own. Overlay the banner with fixed positioning instead, so the page underneath doesn't move.
The second is Largest Contentful Paint (LCP). On a mobile screen, a large text block in the banner can become the largest element in view, so if the banner script loads late, it can delay LCP. Load the consent script early, keep it small, and avoid web fonts or images that the banner has to wait for. The details, including how to measure the banner's impact, are in cookie banners and page speed.
Also avoid entrance animations that delay the buttons becoming usable, and don't show the banner after a timer. Visitors should be able to decide as soon as the page appears.
Fit your brand without nudging
A banner that looks like it belongs to your site is more trustworthy than a generic gray box, and branding is compatible with compliance. Use your fonts, corner radius, colors and tone of voice. The limit is that brand styling must apply to the choices evenly.
Rule of thumb: style the banner however you like, but if you swapped the labels on Accept all and Reject all, nothing about the design should change.
Practical points:
- Dark and light themes. If your site has a dark mode, the banner should follow it, with contrast checked in both.
- Isolated styles. Make sure your site's CSS doesn't accidentally restyle the banner, for example a global rule that turns all buttons into links. Banners drawn in shadow DOM are protected from most of this, but then you need the tool's own styling options to customize them.
- A persistent way back. A small floating button or a "Cookie settings" footer link lets visitors reopen the banner. Make it visible but unobtrusive, and keep it out of the way of chat widgets and back-to-top buttons.
- Consistent tone. Friendly is fine; jokes that make refusal sound foolish are not.
Test before and after launch
A design review on a mockup isn't enough. Test the live banner in several ways:
- Functional test. In a private window, open DevTools and check that no analytics or marketing cookies or requests appear before a choice, that Reject all keeps them off, and that Accept all turns them on.
- Visual test. Screenshot the first and second layers on a desktop, a small phone and a tablet, in each language you support. Compare the two main buttons side by side.
- Keyboard test. Tab to every control, choose with Enter or Space, and confirm focus isn't hidden behind the banner.
- Clarity test. Ask a few people who haven't seen it to say, after five seconds, how they'd refuse cookies. If they hesitate, the design isn't clear enough.
- Withdrawal test. Reopen the settings from another page and change the choice.
Be careful with A/B testing. Comparing variants for readability or task completion is useful. Comparing them only on acceptance rate tends to reward exactly the asymmetries regulators object to, and it would be hard to explain to an authority why the winning design was chosen.
Design review checklist
- Banner appears on any entry page and overlays content without shifting it.
- First layer: heading, short plain-language text, Accept all, Reject all, Preferences, cookie policy link.
- Accept all and Reject all have the same element type, size, style and contrast.
- All buttons are visible without scrolling on a small phone.
- Preference center: optional categories off by default, Reject all present, Save choices saves what's shown.
- Closing or ignoring the banner records no consent.
- Persistent floating button or footer link to reopen settings.
- Works with keyboard, at 200% zoom, and in dark mode.
- No timers, nagging or pressure wording.
If you'd rather not build these defaults yourself, PrivacyQuick's opt-in banner places Reject all next to Accept all with equal styling, starts every category off, draws the banner in shadow DOM so site styles don't break it, and includes a floating button to reopen settings. Custom CSS is available on the Pro plan. See the GDPR cookie banner page for details.
Frequently asked questions
Where should a cookie banner go on the page?
Bottom bars, corner boxes and centered dialogs can all be compliant. What matters is that the banner is noticeable, that its options are equally easy to use, and that it doesn't hide content in a way that pressures the visitor to accept.
Can the Accept button use my brand color?
It can, as long as the reject option is just as visible and readable. The safest approach is to give Accept all and Reject all the same style, both in your brand color or both in the same secondary style.
Is it OK to A/B test my cookie banner?
Testing for clarity and usability is fine. Optimizing purely for a higher accept rate tends to push designs toward the nudges regulators object to, so judge variants on whether visitors understand and can act on their choice.
Should the cookie banner block the page until the visitor chooses?
It doesn't have to. A blocking dialog is acceptable if it offers a real reject option; blocking access until the visitor accepts is a cookie wall, which raises separate legal problems in the EU.
Check your own website in 30 seconds
Our free scanner lists every cookie and tracker your site sets, sorted into categories, before you add a banner.
This guide is general information, not legal advice. Laws and regulator guidance change; check the current rules for your situation or ask a lawyer.