A DeGooglifier for webfonts. Because privacy matters.

Fonts Degooglifier

A script to de-googlify CSS files, downloading relevant fonts in the process. Because privacy matters and self-hosting is a thing.


./degooglify.sh [ 'https://fonts.googleapis.com/css?(...)' | file.css ]

Please note: remember to put the URL in quotes, or otherwise escape any special characters.
Google Fonts CSS URLs contain the pipe character (|) which will be interpreted by your shell and cause the URL passed to degooglify.sh to be incomplete.


The degooglify.sh script takes as arguments local files and URLs (leading to fonts.googleapis.com). It handles multiple arguments, including mixing of URLs and files.

It then downloads the CSS files from URLs provided, and in all local and downloaded files looks for @import (with URL pointing to fonts.googleapis.com) and src: (with URL pointing to fonts.gstatic.com) statements.

For relevant @import statements it will:

  1. download the CSS files, saving them locally
  2. replace the URL with the local file name generated based on the URL
  3. degooglify the downloaded file

For relevant src: statements it:

  1. downloads the font files into the fonts/ subdirectory
  2. replaces the URLs with downloaded font files' locations

Original files are never modified. Instead, copies are created with .degooglified added to the name right before the .css extension.

Filenames of downloaded resources

For CSS URLs, the file names of downloaded files are generated by:

  1. dropping the https://fonts.googleapis.com/css?family= part
  2. replacing all occurences of & and & with __
  3. replacing all occurences of | with _
  4. replacing all occurences of any of :+,= with -
  5. adding .degooglified before the final .css

This is designed to give an informative file name, containing font families, styles, and information on scripts included, based on the information available in the original CSS URL.

For font URLs, the file names of downloaded files are generated by taking the font name from local() stanza in the src: statement, and adding the extension taken from the URL.


An attempt is made to keep dependencies down to as few as possible. Currently these are:

  • Bash 3.x+
  • either curl or wget
  • GNU sed (or any other sed flavor that supports: -i, -e, -E)
  • GNU grep (or any other grep flavor that supports extended regexen)
  • tr
  • standard system utilities (cp, mkdir)

Bugs and feature requests

Please send bug requests and feature reports to tech(at)occrp.org.


GNU Affero General Public License, version 3.