How to Hide Unfilled AdSense Ad Spaces (Official CSS Method, 2026)
Blank AdSense boxes make a site look broken. When Google has no ad to show, an AdSense unit can leave an empty space on your page. The good news: Google officially lets you hide unfilled AdSense ad spaces with one line of CSS, without breaking AdSense rules, or show your own backup ad instead. Here’s how it works in 2026.

Quick answer: Add this CSS to your site: ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }. AdSense marks each ad unit as filled or unfilled, and this rule hides only the empty ones. It’s the method Google itself documents, so it’s allowed.
Table of Contents
Why do AdSense ad spaces stay empty?
AdSense leaves a unit unfilled when it has no suitable ad for that page, visitor or moment. Common reasons:
- Thin or unclear content: AdSense can’t work out what the page is about, so few advertisers match it.
- Low advertiser demand for your topic, country or time of year.
- Policy restrictions on the page, such as sensitive or borderline content that only limited ads can appear on.
- Too many ad units on one page.
- A new site that AdSense is still learning about.
In the early days, AdSense filled these gaps with public service ads. Today it either collapses the unit or leaves a blank space. The long-term fix is better content: clear, detailed pages on a focused topic attract more relevant ads and more search traffic.
Does AdSense collapse empty ads automatically?
Partly. Google says AdSense tries to collapse unfilled units, but only when it won’t make the page jump around (called layout shift). Units already visible on the screen when the page loads usually stay as blank spaces. That’s where the CSS fix helps.
How to hide unfilled AdSense ad spaces with CSS
AdSense adds a data-ad-status attribute to every ad unit on your page:
data-ad-status="filled": an ad is showing.data-ad-status="unfilled": no ad was returned, so the space is empty.data-ad-status="unfill-optimized": no ad was returned, but AdSense’s “Fill empty in-page ads” setting has handled it.
To hide the empty units, add this to the <head> of your site:
<style>
ins.adsbygoogle[data-ad-status="unfilled"] {
display: none !important;
}
</style>If you’re adding it to an existing stylesheet, or in WordPress under Appearance → Customize → Additional CSS, leave out the <style> tags:
ins.adsbygoogle[data-ad-status="unfilled"] {
display: none !important;
}Note: if you’ve turned on Fill empty in-page ads in your AdSense account, empty units get the unfill-optimized status instead, so this CSS won’t hide them. In that case AdSense manages those spaces itself.
Show your own backup ad instead
Rather than hiding the space, you can fill it with your own “house ad”, for example a link to a popular post, your newsletter or your shop. Google documents this method as allowed.
First, add CSS that hides your backup link by default and shows it only when the unit is unfilled:
ins.adsbygoogle a {
display: none !important;
}
ins.adsbygoogle[data-ad-status="unfilled"] a {
display: block;
}Then place your backup image link inside the ad code, just before the closing </ins> tag, at the same size as the ad unit:
... rest of AdSense code ...
<a href="/your-page/"><img src="/backup-ad.jpg" width="300" height="250" alt="" /></a>
</ins>Only make the change Google describes. Other modifications to AdSense code can break the rules and put your account at risk.
What about Auto ads?
If you use AdSense Auto ads, Google decides where ads go and only inserts them when it has one to show, so you won’t usually see empty Auto ad spaces. The CSS fix is mainly for manual ad units you’ve placed yourself.
Frequently asked questions
Is it allowed to hide unfilled AdSense ads?
Yes. Google’s AdSense Help explains this exact CSS method, so using it doesn’t break the program policies.
Will hiding empty ads reduce my earnings?
No. Unfilled units earn nothing anyway. Hiding them just improves your page design. A backup ad can even bring extra value from the same space.
Why are my AdSense ads blank on some pages only?
Usually because of the page’s content. Thin pages, unclear topics or pages with limited-ads content get fewer matching ads. Improving the content often helps.
Stuck on a gift? Try our free Gift Idea GeneratorIdeas for anyone by age, job, interests and budget, with Amazon.com and Amazon.in linksFind gifts →Get our free weekly email: new tech guides and tools, no spam.
New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.
One email a week. Unsubscribe anytime. See our privacy policy.






