How to Self-Host a Web Font From Google Fonts
Posted4 months agoActive4 months ago
blog.velocifyer.comTechstoryHigh profile
calmmixed
Debate
60/100
Web DevelopmentFontsSelf-Hosting
Key topics
Web Development
Fonts
Self-Hosting
The article discusses how to self-host a web font from Google Fonts, sparking a discussion on the benefits and trade-offs of self-hosting fonts, as well as related topics like font optimization and privacy.
Snapshot generated from the HN discussion
Discussion Activity
Very active discussionFirst comment
19m
Peak period
60
0-3h
Avg / period
10.4
Comment distribution135 data points
Loading chart...
Based on 135 loaded comments
Key moments
- 01Story posted
Sep 15, 2025 at 10:33 AM EDT
4 months ago
Step 01 - 02First comment
Sep 15, 2025 at 10:52 AM EDT
19m after posting
Step 02 - 03Peak activity
60 comments in 0-3h
Hottest window of the conversation
Step 03 - 04Latest activity
Sep 17, 2025 at 8:51 AM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45250202Type: storyLast synced: 11/20/2025, 6:33:43 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
https://damieng.com/blog/2021/12/03/using-variable-webfonts-...
Not if the font data is in a style tag in head, or otherwise before any content that's display might need, or be indirectly affected by, the font.
It will delay first paint on slow connections (all connections, in fact, but on a strong link you'll not notice) though.
Not doing it is also nicer for people with slow/unreliable network access, where they can block fonts, or even if they don't block them, can access your page more quickly and have a render without the custom font.
But Gen-Z, and now Gen-A even more, were born into the technology, so they never had to learn it besides as users. So they have no clue how thing work. All they know is how to push a button. So in a way, they are crippled by the comfort they were brought into from the get-go. They were never forced to build their own computer nor figure out issue with the operating system, let alone how to program something, etc...
So with each new generation, the technological literacy falls off the cliff more and more. It is not their fault, their circumstances are simply different.
Side note: it really IS people rediscovering css from 20 years ago!
I get why it is "better" -- CDN, optimized for browser blah blah. But I really wanted to host it myself, because 1) it's my website 2) I don't want every visitor to send a piece of information about themselves to Google just to get some fonts.
But apparently Google is not motivated to offer such a solution, at all.
At that time it would take me more than a few minutes (which was what I had), and seemed a rabbit hole. I decided not to pursue that.
If you don't believe me, you are welcome to try it out yourself FROM SCRATCH without any references whatsoever, and see how long it takes you to come up a solution that works on all 5 or 6 platforms, desktop or mobile.
It's not a lie—I've been doing exactly that as long as Google fonts has been a thing.
I think people are confusing what was required in the back in the day when browsers were buggy and supported different font formats--15+ years ago.
The technique was called the "bullet proof" @font-face syntax because it "solved" getting web fonts to work across operating systems and devices in the 2010's [1]:
If you weren't doing web development back then, you don't understand what a revelation this syntax was for supporting cross-browser web fonts. There were even websites that would generate the syntax for you. BTW, woff2 didn't exist then.It seems that some developers, like the Japanese soldiers who didn't stop fighting WWII until the 1970's because they didn't know the war ended in 1945 [2], still believe dealing with fonts in 2025 is like it was 15 years ago.
It's never been easier to self-host fonts… why make an additional HTTPS request if you don't have to?
There are plenty of utilities to compress TrueType or OpenType fonts to WOFF2.
[1]: https://www.paulirish.com/2009/bulletproof-font-face-impleme...
[2]: https://en.wikipedia.org/wiki/Hiroo_Onoda
From memory, what I would do is simply download the original ttfs or otfs, run them through woff2 (https://github.com/google/woff2), and then write the @font-face declarations for each weight/style variation. Variable fonts make this even easier, since you can get by with just the one declaration.
One could further optimise them for size with fonttools, to do stuff like subsetting by unicode ranges (https://github.com/fonttools/fonttools), but that's quite optional. Unless your font includes CJK, it's probably not that big to begin with.
https://dev.to/rstacruz/public-cdns-arent-useful-anymore-2b6...
It's also not nearly as unbelievable as you seem to think it sounds that it could be happening without anyone blowing the whistle. What would you expect to happen if they did? Does "Google tracks lied about tracking users through front downloads" sound like front page news, or something that would stay on people's radar for more than a day or two even if it was? It's hard to imagine that there would be any sort of fine that would reach a level that mattered to Google, or that the recent antitrust case would have had a different outcome if only the font conspiracy had been discovered. Trying to blow the whistle on it just wouldn't be worth it.
I have very recent -- like, 2 weeks ago -- successful experience of using these, since I wanted to distribute a WOFF2 as part of a browser extension.
[0] edited to add - you don't have to build it, you can get it from homebrew https://formulae.brew.sh/formula/woff2 or an Arch package https://archlinux.org/packages/extra/x86_64/woff2/ and presumably other distros
Wait a moment, why should this be Google's job? They're not the lords of your HTML and CSS. In fact, they have no duty to help you with anything at all, and neither does anybody else except your mother.
It lets you pick from the Google Fonts catalog, and comes with various options for further reducing the fonts' sizes if you're as obsessed with webpage size as I am.
I do have a minor constructive criticism, as someone that does not use Apple, I found the '+' to actually select a Google Font to be far from intuitive. I was looking for a big button in the bottom right with 'Select' (or some other label).
Other than that, bookmarked, kettle on and fired up to get my fonts optimised. Thank you.
Completely different use case, where it assumes you have the font downloaded already, and every new regen of your static site you regenerate the font for what’s required to render it.
Definitely curious as this seems a much better way to handle things ergonomically instead of the way author suggested way
I also feel like hosting your own cdn is definitely easy with this by just downloading npm package or embedding it directly I suppose?
There are definitely other ways to do this too. This discussion was really fun as I saw so many ways to embed fonts other than what I had known but this seems to be a mix and match between privacy and not having to embed it myself.
I just checked and jsdelivr has had like 300 billion requests past month and over 16,813 TB
Really fascinating stuff. I will try to use this from now on! (earlier I was thinking of using something like coollabs.io but I checked its code and I see that the fonts are served through something like bunnycdn from coollabs side which is cool but still)
Honestly, what other things would be better off packaged as npm packages as I never thought that packaging fonts as npm package should make so much sense but here we are!
Bookmarked!!
With a zero-tracking and no-logging policy, Bunny Fonts helps you stay fully GDPR compliant and puts your user's personal data into their own hands. Additionally, you can enjoy lightning-fast load times thanks to bunny.net's global CDN network to help improve SEO and deliver a better user experience.
My brain breaking because I don’t know if that comma denotes thousand or decimal in this context.
Knowing about npm / js I genuinely think that it might in the thousands in this context (I think)
Someone should confirm it I suppose
Insane to think about fonts and all this bandwidth.
WAT
Like, as someone who teaches IT -- an article like this getting this high in hacker news is just very wild to me. Which is to say:
The answer that ought to be obvious to this crowd is "Download it and link to it in your HTML/CSS in your local html directory."
Now, I'm aware that at least part of the reason this isn't the extremely obvious answer has to do with some friction on the downloading as well as perhaps cdn stuff.
But still; wow. As far as we have gotten in some ways, we've clearly lost A LOT of simplicity that shouldn't be -- but apparently -- really difficult to recover.
I've had to do this several times in the past because the customer firewall blocks google domains, and it never required a second thought. The only question I had was around the legality of doing so (which I checked on). Once I verified that, it was about 2 minutes of wget (or curl) the file down, stick in a static web server, and update the links in the HTML page and Bob's your Uncle
I'm not sure that it matters that you or Google hosts it. Same as any free software actually.
"And perhaps even the idea of having to think about the legality of such things is part of the problem, I can remember when we'd just DO IT."
:)
It might be because it's a "You should host web fonts from Google Fonts yourself" in disguise. The technical "How to" is almost not the important part here :-)
It may give some pause to web devs who hotlink to google here on HN without much thoughts and make them consider doing it differently next time.
I suspect many people upvoting it are doing it for this. Maybe upvotes here might actually mean "Please host Google Fonts yourself".
I think you can revert by editing your submission afterwards.
Writing a tool to do all that work for you is the hacker spirit. Mocking the work is not.
At fonts.google.com:
Find font; click download (it's the SECOND blue button)
Unzip and upload to your website.
What am I missing here?
Is it not as simple as...
https://github.com/ebrasha/abdal-ttf-woff2
So things got to become common sense for us because it was easy to get overwhelmed in information on why it should be common sense. The web has changed dramatically - there is a lot of content in Discord servers and it’s rare for frequently asked Discord questions to turn into web content. Common sense isn’t as wide ranging, but that’s been replaced by extreme specialty knowledge.
I see this a lot in software companies when build tools crap out. Younger developers have much more specialized knowledge on the build tools and can outwork me when everything is on the happy path. Off the happy path, all the general bits and pieces we picked up through osmosis back in the day become very helpful.
I’m glad that articles like this are being promoted. This plumbing type knowledge will be useful many many times over the course of a career. Not everything has to be aimed at me to be good, you know?
https://www.theregister.com/2022/01/31/website_fine_google_f...
Google Fonts has an open issue that is three years old here, with no response from Google:
https://github.com/google/fonts/issues/5537
https://github.com/google/fonts/issues/1495
> Also, please note that Google LLC is certified under both the EU-U.S. and Swiss-U.S. Privacy Shield frameworks and our certifications can be viewed on the Privacy Shield list.
It’s very important to be aware that the Privacy Shield was declared invalid by the European Court of Justice in 2020, so that note from April 17, 2018 is worthless.
As the website I was optimizing was selfhosted, also selfhosting the font had a noticeable effect on the page load time. See https://github.com/SmilyOrg/photofield/commit/12352667c01624...
I'm not sure what you mean with the rest of the comment though, it's a very small change and it gets cached by the browser like other static assets, so I'm not sure what is the overkill here.
I had to go digging for it again and I've now bookmarked it, but this website/repo has some nice examples: https://modernfontstacks.com/
I do really wish that instead of moving in that direction, that customization was the norm, with sites specifying "serif" and "sans-serif" and users were assumed to be setting those settings to what they prefer. Similar to how dark mode is now respected on at least the plurality of "important" sites.
With built in fonts, if you want to support a wide range of machines, you have seven reliable fonts, one monospace and one cursive font to choose from. Georgia is a good looking serif font and I use it too much now, but the sans serif pairings aren’t great.
With CSS, you can make arial work as a heading font with a Georgia body for example, but that takes time and creates a testing burden. It only takes seconds to host a font that looks great out of the box and imposes a smaller testing burden. So for me the answer is a lack of talent that I’ve mitigated through transferring fonts on requests. I don’t think that’s a good thing, but my designs are no longer covered by a Geneva convention so that makes me feel better. :)
[0] https://files.velocifyer.com/Warant%20canaries/
For example, here's Roboto Mono WOFF2s: https://github.com/googlefonts/RobotoMono/tree/main/fonts/we...
debatable :)
> is not there
https://github.com/google/fonts/tree/main/ofl/notosans
> What does using the Google Fonts Web API mean for the privacy of my users?
> The Google Fonts API is designed to limit the collection, storage, and use of end-user data. The use of the Google Fonts Web API is unauthenticated and the Google Fonts API does not set or log cookies. Requests to the Google Fonts Web API are made to resource-specific domains, such as fonts.googleapis.com or fonts.gstatic.com. Font requests are separate from and don't contain any credentials sent to google.com while using other Google services that are authenticated, such as Gmail.
> When I embed Google Fonts in my website via the Google Fonts Web API, what data does Google receive from my website visitors?
> When end users visit a website that embeds Google Fonts, their browsers send HTTP requests to the Google Fonts Web API. [ snipped details of how HTTP works and headers like referrer ]
> For clarity, Google does not use any information collected by Google Fonts to create profiles of end users or for targeted advertising.
(There's also an answer to what they do that is different than statically hosting: [2])
[1] https://developers.google.com/fonts/faq/privacy
[2] https://developers.google.com/fonts/faq/privacy#what_are_the...
I really love this line:
> For clarity, Google does not use any information collected by Google Fonts to create profiles of end users or for targeted advertising.
Except they already have a profile of you, I promise. For instance, they explicitly don't say they don't use information from google fonts requests to update their existing profiles of you.
Like you said- it doesn’t mean that Google itself can’t use that data.
GOOG certainly doesn’t care either, as they really don’t need secret, ill-gotten font data. Like 80% of Internet use is using the browser they wrote and most sites already have their ad tracking JS running.
Just thought it relevant that the popular opinion here about it is in direct contradiction of what Google is saying. Persisting in believing there’s some secret malevolence at play here is not surprising, but it’s not disprovable, so it is fair to say it’s a matter of faith rather than of fact.
This is the company that set up a fleet of cars to take photos of everything and snort up wifi traffic while they were at it. https://www.wired.com/2012/05/google-wifi-fcc-investigation/
I think that
> Google does not use any information collected by Google Fonts to create profiles of end users or for targeted advertising.
should be read as:
> Google does not CURRENTLY use any information collected by Google Fonts to create profiles of end users or for targeted advertising.
Also note that the text as-is says nothing about updating existing profiles, just that new ones won't be created from this data.
> Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license.
- host my fonts and therefore if something does not work, nothing iwll work (whihc is a consistent user experience)
- or source from Google directly but if Google goes down or the user somehow filters Google, the experience will be awful
I chose to use the Google way - not only are they much better than I am in everything, but the user may miraculously have the font cached, a small bonus
But yes, I get what you are saying and the rationale I used initially when hosting everything was the same. I may indeed get back to that.
In that case I prefer to set one for a consistent and predictable experience
And while you're at it (and you use multiple fonts), you might as well use CSS's font-face to harmonize the different fonts a little. Fonts with the same size might look bigger or smaller to the eye, depending on thickness of the lines and other font styles.