Google Approves Responsive AdSense Ads

When AdSense launched a decade ago, people mostly accessed websites on their desktop or laptop computers. Fast forward today and all sorts of devices – mobile phones, gaming consoles, ebook readers and even televisions – are being used to connect to the Internet.

Web designers are therefore increasingly relying on a technique called Responsive Web Design where a single layout works across all devices, irrespective of the screen size or the resolution of the visitor’s device.

Google AdSense ads are fixed-width but there’s a little workaround that can  make your Google ads responsive. The idea is that if a visitor is reading your web page on a large desktop screen, they are served the large 728x60 or 336x280 units while if another visitor is viewing the same page on a smaller mobile screen, you can dynamically serve the 200x200 (or similar) ad unit.

I shared a JavaScript snippet last year and, since then, its been a topic of debate in several online forum threads. The primary concern among web publishers was (and still is) that Responsive Google Ads could be against Google AdSense policies since they require modification in the default JavaScript code.

Michel Wester of, an AdSense publisher from Netherlands, contacted the Google AdSense team for a confirmation and here’s the official response (in Dutch):

Responsive Google Ads “De voorbeeld website die u stuurt geeft al de juiste javascript code die u kunt gebruiken.” Google AdSense support has confirmed that Responsive Ads are allowed.

The rough Dutch to English translation is:

AdSense Ads can be adapted to different screen sizes using a simple JavaScript snippet. To take advantage of responsive design, create multiple ad formats, such as 728x90, 468x60 and 300x250. Then you implement an “if-else’ fragment so that the right ad format is displayed based on the size of the device of the user.

The example website that you sent has the correct JavaScript code that you can use. Well I would like to emphasize that further change the AdSense code is not allowed. Advertisements may also not be hidden with CSS.

Thus you won’t violate any of the AdSense program policies for using responsive ads on your website. The JavaScript snippet isn’t modifying the AdSense code but is simply requesting a different ad unit based on the viewport width of the current visitor’s screen.

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.