Skip to main content

A module filter.

Responsive images

Images

Serves a srcset so each device downloads an image sized for its screen.

Filter responsive_images,responsive_images_zoom,rewrite_images,inline_images,resize_images,insert_image_dimensions · Filter docs · Read the full guide

Original Open in new tab
Optimized Open in new tab

Both frames render identically — that's the goal. The win is in the bytes and requests below, not the look. They're served live by the mod_pagespeed module on demo-httpd-1.1.modpagespeed.com; the optimized frame applies only this filter. Right after a cache purge it may briefly match the original while the worker rewrites it — reload to see the result.

Measured impact

Measured on the Responsive images demo page, original against optimized: the total weight (HTML plus the files it loads) falls from 264.8 KB to 83.6 KB, 68% smaller, but the page makes 8 HTTP requests instead of 5.

Total bytes

original
271,171 B
optimized
85,590 B

−185,581 B −68% in size

Measured on the demo stack, November 2026.

What changed in the source

The page's HTML, before and after this filter. Red lines are removed, green lines are added.

                
                  
… 4 unchanged lines …
<body>
<p>An 1023x766 image displayed in a 256x192 thumbnail. PageSpeed
will resize it and also serve with a srcset for other sizes.</p>
- <img src="images/Puzzle.jpg" width="256" height="192"/><br/>
+ <img src="images/256x192xPuzzle.jpg.pagespeed.ic.yLMfjJnvDr.webp" width="256" height="192" srcset="images/384x288xPuzzle.jpg.pagespeed.ic.NQCrVsrYJU.webp 1.5x,images/512x384xPuzzle.jpg.pagespeed.ic.j5Q8hewwcs.webp 2x,images/768x576xPuzzle.jpg.pagespeed.ic.J7pFI_sIxX.webp 3x,images/xPuzzle.jpg.pagespeed.ic.H8AYL0e7U2.webp 3.996x"/><br/>
<p>An 1023x766 image displayed at full size. PageSpeed may recompress it,
but will not add a srcset.</p>
- <img src="images/Puzzle.jpg" width="1023" height="766"/><br/>
+ <img src="images/xPuzzle.jpg.pagespeed.ic.H8AYL0e7U2.webp" width="1023" height="766"/><br/>
<p>An 1023x766 image displayed at 682x511 (2/3 scale). PageSpeed will
resize it and also serve a 1.5x version in srcset (but not 2x since
that would be redundant).</p>
- <img src="images/Puzzle.jpg" width="682" height="511"/><br/>
+ <img src="images/682x511xPuzzle.jpg.pagespeed.ic.Jo1XQQvY4j.webp" width="682" height="511" srcset="images/xPuzzle.jpg.pagespeed.ic.H8AYL0e7U2.webp 1.5x"/><br/>
<p>A small image. PageSpeed will inline it and not set a srcset.</p>
- <img src="images/Cuppa.png" width="10" height="10"/><br/>
+ <img src="images/10x10xCuppa.png.pagespeed.ic.nUlQR0PctU.webp" width="10" height="10" srcset="images/15x15xCuppa.png.pagespeed.ic.7Tjt0KP9SJ.webp 1.5x,images/20x20xCuppa.png.pagespeed.ic.690k6MYQ3i.webp 2x,images/30x30xCuppa.png.pagespeed.ic.LBw3Zm4zsI.webp 3x,images/xCuppa.png.pagespeed.ic.FlgX5ioeLe.webp 6.5x"/><br/>
<p>A medium size image with no listed width nor height. PageSpeed
will losslessly re-encode it, but not resize it nor add a srcset
for other sizes.</p>
- <img src="images/BikeCrashIcn.png"/><br/>
+ <img src="images/xBikeCrashIcn.png.pagespeed.ic.6xiLLvy7qg.webp" width="100" height="100"/><br/>
<p>An image with data-pagespeed-no-transform. PageSpeed will not
transform this file.</p>
- <img src="images/disclosure_open_plus.png" width="11" height="13" data-pagespeed-no-transform/><br/>
- </body>
+ <img src="images/disclosure_open_plus.png" width="11" height="13"/><br/>
+ <script src="/pagespeed_static/responsive.dBVE-jC1z_.js"></script></body>
</html>

Run this on your own site

This is one of 49 filters the mod_pagespeed module applies in place — self-hosted on Apache, nginx, and IIS. Install and run it: it optimizes right away and adds the optimized response headers shown above. Open source under the Apache License 2.0 — free in development and in production.

Search