Skip to main content

filter · CSS filters

Inline Google Fonts CSS (inline_google_font_css)

Category:
CSS
CoreFilters:
No
OptimizeForBandwidth:
No
Risk:
Generally safe

Fetches the CSS from the Google Fonts API and inlines it directly into the HTML, eliminating one round trip. Requires HTTPS fetching to be enabled. GDPR considerations apply in the EU: inlining the CSS avoids the browser contacting Google Fonts servers directly, which can help with compliance.

When to use it

  • Not in CoreFilters: it runs only when you enable it by name.
  • Risk rating on these docs: Generally safe.

Risks

The CSS filters page lists no specific risks for this filter. If a page misbehaves with it, DisableFilters inline_google_font_css turns it off for the scope you set it in.

Configuration

Enable it in the module configuration, at server, virtual-host or location scope:

Apache

ModPagespeedEnableFilters inline_google_font_css

nginx

pagespeed EnableFilters inline_google_font_css;

IIS (pagespeed.config)

pagespeed EnableFilters inline_google_font_css

Scoping, ForbidFilters and the thresholds filters read: Choosing filters .

Live example

Inlines the small font-loading CSS that the Google Fonts API serves.

Measured on the demo page, original against optimized:

  • Total bytes

    569 B → 559 B −2%

See the before and after, with the source diff →

Frequently asked questions

What does the inline_google_font_css filter do?
Fetches the CSS from the Google Fonts API and inlines it directly into the HTML, eliminating one round trip. Requires HTTPS fetching to be enabled. GDPR considerations apply in the EU: inlining the CSS avoids the browser contacting Google Fonts servers directly, which can help with compliance.
Is inline_google_font_css enabled by default?
No. inline_google_font_css is not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name with EnableFilters.
How do I enable inline_google_font_css on Apache and nginx?
Add ModPagespeedEnableFilters inline_google_font_css on Apache or pagespeed EnableFilters inline_google_font_css; on nginx. On IIS, add pagespeed EnableFilters inline_google_font_css to pagespeed.config.

This page is drawn from the inline_google_font_css entry on CSS filters. Every filter in one table: PageSpeed filters.

Google Analytics, AdSense, Fonts and Hosted Libraries are Google products. We-Amp isn't affiliated with or endorsed by Google.

Search