Skip to main content
ModPageSpeed 2.0 and mod_pagespeed 1.1 — Coming Soon

Filters Overview

All mod_pagespeed 1.1 optimization filters organized by category. Image, CSS, JavaScript, HTML, and caching filters with quick descriptions.

mod_pagespeed 1.1 organizes its optimizations as filters. Each filter performs a specific transformation on HTML responses as they pass through the web server. Filters can be enabled individually with directives or activated in groups via RewriteLevel presets (CoreFilters, OptimizeForBandwidth). See filter selection for configuration details.

Image filters

Image filters reduce image payload by recompressing, converting to more efficient formats, resizing to rendered dimensions, and inlining small images as data URIs. These filters typically produce the largest bandwidth savings on image-heavy pages.

  • rewrite_images (core) — master image optimization that combines recompression, format conversion, and resizing
  • convert_jpeg_to_progressive, convert_jpeg_to_webp, convert_png_to_jpeg — format conversion for smaller file sizes
  • recompress_images — lossless recompression without changing format
  • resize_images, responsive_images — dimension-aware optimization based on rendered size or srcset
  • inline_images, lazyload_images — delivery optimization: inline small images as data URIs or defer offscreen image loading

Full reference: Image filters

CSS filters

CSS filters reduce stylesheet size and the number of HTTP requests required to load them. They minify CSS, combine separate stylesheets into fewer files, inline small stylesheets directly into the HTML, and flatten @import chains.

  • rewrite_css (core) — minification and whitespace removal
  • combine_css (core) — merge multiple <link> elements into a single request
  • inline_css (core) — inline small stylesheets into <style> elements
  • flatten_css_imports (core) — resolve @import rules into a single stylesheet
  • prioritize_critical_css — extract and inline above-the-fold CSS, deferring the rest

Full reference: CSS filters

JavaScript filters

JavaScript filters reduce script size and control when scripts execute. They minify source, combine separate scripts to reduce round trips, and defer execution until the page has loaded.

  • rewrite_javascript (core) — minification and whitespace removal
  • combine_javascript (core) — merge multiple <script> elements into a single request
  • inline_javascript (core) — inline small scripts directly into the HTML
  • defer_javascript — defer script execution until after the page finishes loading

Full reference: JavaScript filters

HTML filters

HTML filters optimize the HTML document itself. They remove unnecessary whitespace and comments, add performance hints such as DNS prefetch and preload headers, and fix structural issues in the document.

  • collapse_whitespace, remove_comments — HTML minification by removing non-significant whitespace and comments
  • insert_dns_prefetch, hint_preload_subresources — performance hints that enable early resource discovery
  • add_head, convert_meta_tags (core) — structural fixes that ensure a well-formed document

Full reference: HTML filters

Caching and URL filters

Caching filters extend browser cache lifetimes by rewriting resource URLs to include content hashes. This allows setting long Cache-Control max-age values while ensuring that browsers fetch updated resources when content changes.

  • extend_cache (core) — rewrite CSS, JavaScript, and image URLs with content-based hashes and set long TTLs
  • extend_cache_pdfs — apply the same content-hashed URL strategy to PDF links

Full reference: Caching and URL filters

Quick reference

For a complete table of all ~44 filters with their default levels and descriptions, see the filter reference.

Deprecated filters

Certain filters that targeted Google-specific services remain available for backward compatibility but are not recommended:

  • insert_ga — Google Analytics snippet injection
  • make_google_analytics_async — asynchronous GA conversion
  • canonicalize_javascript_libraries — rewrite to Google Hosted Libraries CDN

The services these filters target have been retired or significantly changed. New deployments should not enable them.