The trade in one line
Base64 turns every three bytes into four characters, so the file grows by about a third, and the CSS cannot be cached separately from the font. In exchange, the font travels with the document.
Encode it
- Open the font to Base64 converter.
- Drop the TTF or OTF. It is compressed to WOFF2 first, because that is the smallest starting point.
- Copy the generated
@font-facerule — the data URI is already in it. - Paste it into the email template or the single-file page and test in the client that will render it.
The Gmail problem
Gmail clips messages larger than roughly 102 KB, and its web client does not render @font-face reliably anyway. A full font family in Base64 will be clipped or ignored. What works is a subsetted font — a few dozen glyphs for a headline — and a fallback stack that looks deliberate when the font does not load.
Better uses
Single-file HTML reports that must open offline, kiosk pages, an embedded widget that cannot fetch a second file, and documentation that gets emailed as one attachment. In each case the constraint is real: one file has to carry everything.
What not to do
Do not inline a font on a normal website to save a request. Modern browsers prioritise font requests, the data URI blocks the stylesheet from completing, and you lose caching for every repeat visit.