- base64 encoded strings are larger than the real file size.
- It blocks browser rendering. Browsers can still render a page while it's downloading the fonts. Not while it is downloading CSS.
- Makes cache busting hard. You will update CSS files more often than fonts. Fonts, served with right headers, can stay longer in browser cache.
- Base64 encoded strings don't compress well. I go as far as sorting the attributes/combined classes to increase the compressibility of the CSS, but base64 strings hardly compress.
You won't see FOIT/FOUT because the browser is outright blocking the rendering until the CSS is completely downloaded. That is arguably a worse outcome.
1: LCP – Largest Contentful Paint – a core web vital metric representing time for the visible viewport to be stable. This is better than the old "document ready" because document ready is technical, hundred other things like reflows can happen after document ready. Whereas LCP represents from a user perspective when the viewport is ready. When fonts create reflows, the viewport becomes unstable and LCP will be higher. Lower LCP = Better user-perceived loading time. https://web.dev/lcp/
Simply because it's not very performant. base64 will make the file about 30% larger, and web fonts are already too big. It'll also block the rest of the CSS file which can delay layout calculations, and the font-display property won't work either.
I could make a similar argument to say not to use CSS files, just embed everything into the page.
Unless you have a ton of files, listing them all in the html will make them load just about as fast as a single file listed in the html.
Then the poor user has to download heavier html on every page as the browse the site.
I don’t know why more websites don’t do this. Even having one large CSS file with everything compressed is much much faster then the waterfall of more files/connections.
I recommend postcss-import that takes your file paths and embeds the files during build. Use responsibly.