How to Hide Empty AdSense Slots When No Ads are not Available

When there are no advertisers available for a specific page, Google AdSense will replace the ad units on that page with a blank space. You can easily hide the empty slots with the help of CSS

If you are using Google AdSense to monetize your website, you may have noticed that there are instances when there are no ads showing up on one or more pages.

This is likely because Google AdSense is not able to find any advertisers that are probably willing to bid on your page at that time. Or may be you have blocked specific categories of advertisers from bidding on your page.

When Ads Are Available

Here’s a page with a Google AdSense ad unit placed somewhere in the middle of the page.

Google AdSense Ads

When Ads Are Unavailable

And here’s the same page with the same Google AdSense ad unit but with the ad unit replaced with a blank space as the ad inventory is not available.

Google AdSense Ads Unfilled

Behind the Scenes

When any Google AdSense ad unit on your website sends an ad request to Google’s servers, the AdSense server either responds with an ad or it sets the status of the ad unit to unfilled meaning that there are no ads to serve at that time.

If you would not like to see any whitespace in your website because of unavailability of ads, you can easily hide the unfilled ad units with CSS.

Open your website template and add the following CSS to the <head> section of your HTML:

  ins.adsbygoogle[data-ad-status='unfilled'] {
    display: none !important;

Now if there are any empty ad slots on your website, they will collapse and will not be displayed. You may also consider replacing the unfilled AdSense ad unit with a fallback image that internally links to one of your own pages.

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory


Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.