How to Remove Yellow Border Around AdSense Ads (2026)

Seeing a yellow border around AdSense ads on your site? It usually shows up when Google serves a smaller ad inside a bigger ad slot, and your WordPress theme paints the empty space yellow. We first spotted it on the Twenty Thirteen theme in 2013, and it still happens on sites using that theme or child themes based on it. Here’s why it happens and how to remove the yellow background with one line of CSS.

Yellow border around AdSense ads

Quick answer: AdSense places every ad inside an <ins class="adsbygoogle"> tag. Some themes, including Twenty Thirteen, style all ins tags with a yellow background (#fff9c0). When a smaller ad fills a larger slot, that yellow shows around it. Fix it by adding ins.adsbygoogle { background: transparent; } to your theme’s Additional CSS.

Why is there a yellow border around AdSense ads?

AdSense can show a smaller ad in a larger slot when it expects that ad to earn more, for example a 300×250 ad inside a 336×280 ad unit. The leftover space should be blank, but it takes the background colour of the ad’s container.

Every AdSense ad code, including the asynchronous ad code used today, wraps the ad in an ins element:

<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-1234567890"
     data-ad-slot="1234567890"
     data-ad-format="auto"></ins>

The HTML ins tag normally marks “inserted text”, so some themes highlight it. Twenty Thirteen’s stylesheet includes:

ins {
	background: #fff9c0;
	text-decoration: none;
}

That pale yellow (#fff9c0) is what you see around the ad.

How to remove the yellow border around AdSense ads

  1. In WordPress, go to Appearance > Customize > Additional CSS. (On block themes, use Appearance > Editor > Styles > Additional CSS.)
  2. Add this CSS:
    ins.adsbygoogle {
    	background: transparent;
    }
  3. Click Publish, then clear your caching plugin and CDN cache.
  4. Reload the page. The yellow area is gone.

Targeting ins.adsbygoogle instead of every ins tag keeps the highlight working for real “inserted text” elsewhere on your site. If your page background isn’t white and you prefer a solid colour, use your background colour instead of transparent.

Hide empty AdSense slots too

Sometimes there’s no ad at all, and you see a blank or coloured box. AdSense marks these slots with data-ad-status="unfilled", so you can hide them with:

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

We explain this official method in detail in how to hide unfilled AdSense ad spaces.

Other causes of coloured boxes around ads

  • Theme or plugin ad wrappers: ad plugins often add a div with padding or a background. Inspect the ad (right-click > Inspect) and check which element has the colour.
  • Auto ads placements: with AdSense Auto ads, Google adds its own containers; style them with the same ins.adsbygoogle rule.
  • Dark mode: if your site has a dark theme, a white ad background can look like a border. Set the ad background to match your page.

Don’t change the ad itself, add borders that look like part of the ad, or place images to frame it. Google’s AdSense Program policies don’t allow modifying ad code or styling that could mislead users, but changing the background of the empty space around an ad is fine.

Frequently asked questions

Is it allowed to change the background of AdSense ads?

Yes, you can change the background of the container or empty space around the ad. You can’t edit the ad’s own code or content.

Does the yellow border reduce AdSense earnings?

It can. A bright box draws attention to the ad’s size and makes the page look unfinished, which can lower clicks.

Which themes add a yellow background to ads?

Twenty Thirteen and themes built on it are the best-known examples, but any theme that styles the ins tag can do it.

Why don’t I see the yellow border every time?

It only appears when AdSense shows an ad smaller than the slot, so it comes and goes from page to page.

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 →

Found this useful? Share it with someone who needs it.

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.

Related Tech Guides

Leave a Reply

Your email address will not be published. Required fields are marked *

16 Comments

  1. I just want to confirm if it will violate any adsense policy? I didnt found any information about it on the official adsense blog.

  2. One of those rare moments where the web delivers something back of value and with such clarity!

    Great job!

  3. I noticed that the code slightly delays the page load time even though I use a host with very quick page call times. I’ll keep the code over the next week or so and see if the couple second delay impacts traffic.

  4. Thanks for this tips i was just looking for this tips. I don’t like this yellow background.

  5. Hi Chandra,

    Very cool post! Thank you for sharing with us how to remove the yellow border in Google Adsense. I will go ahead and give it a try! :-)

  6. Thanks for sharing this tip, Yellow border does look a little annoying and Now I know how to get rid of it.

  7. Great trick to remove those yellow border which been little annoying to have them on our ads hope to remove them from my blog

  8. That’s a nice CSS trick Chandra. I haven’t noticed the yellow border until I read your post since I’ve been using Adblock extension on my browser. It looks a bit odd. Will remove it for sure and see if it improves the CTR. Thanks for the trick.

  9. Whoa! Thanks for this one. Before, I had trusted YouTube videos for this kind of work. This task, on the other hand, is just too much for a video. You cannot really document the codes that you will have to put in the boxes. Your article nailed it for everyone who is into AdSense.

  10. hi chandra i would like to say you did very well and i was looking same problem answer but finally i got it.

  11. Hi Chandra,

    Nice post.
    I think there is one more option to remove this border. If you have an premium adsense account, you can edit the ad formats as well.

    1. This border is more of a theme styling issue. Premium adsense accounts can get custom Adsense sizes as per their site design.

  12. Hi Chandra,

    Great Post as always.

    Really helpful for bloggers those who making money from adsense.

    1. My CTR improved with this single CSS tweak. Strangely did not see this border in Firefox, but always in Chrome.