Convert a font to Base64

Sometimes a page cannot load a second file: an HTML email, a single-file report, a widget that must work offline. Embedding the font as a data URI removes the request, at the cost of about a third more bytes.

Convert a font to Base64

Drop your font files here

Or choose files from your device

TTF, OTF, WOFF, WOFF2, TTC or OTC in · up to 20 files · max 40 MB each

Every file is parsed and converted in this tab. Nothing is uploaded.

    No font added yet.

    Three steps — nothing to install

    1. Drop the font

      TTF or OTF works best as the source; the output is always WOFF2 before encoding, because that is the smallest starting point.

    2. Choose Base64 mode

      You get a complete @font-face rule with the data URI already in place, ready to copy.

    3. Paste and test

      Paste it into the stylesheet or the email template and check the result in the client that will render it.

    When Base64 is the right answer

    HTML email is the main case: many clients block external fonts, and a data URI travels inside the message. Single-file HTML reports, offline kiosks and embedded widgets have the same problem — one file has to carry everything.

    For an ordinary website it is the wrong answer. A data URI cannot be cached separately, it inflates the CSS by about a third, and it blocks the stylesheet from finishing until the font has downloaded.

    What the encoding actually costs

    Base64 turns every three bytes into four characters, so a 180 KB WOFF2 becomes roughly 240 KB of text. Email clients also have size limits, and Gmail clips messages around 102 KB — which is why a subsetted font, not a full family, is usually what belongs in an email.

    Frequently asked questions

    Why is the output WOFF2 rather than the original format?WOFF2 is the smallest form the font can take before encoding, so the data URI is as short as it can be. The glyphs are unchanged.
    Will Gmail show the custom font?Gmail's web client does not support @font-face reliably, and it clips large messages. Treat the embedded font as a progressive enhancement and make sure the fallback stack looks right.
    Is there a size limit?The page handles up to 40 MB per file, but a data URI that large is impractical. Keep embedded fonts to a subset of the characters you actually use.
    Is the font uploaded to create the data URI?No. The compression and the encoding both happen in the browser.