Vector & CSS Delivery Formats

RFC 4648 Base64 Embedded Font CSS

Base64 Data URI encoding embeds a WOFF2/TTF binary directly inside @font-face src: url('data:font/woff2;base64,...') with zero extra HTTP requests.

.csstext/cssUpdated:
CompressionUncompressed SFNT
Outline / CurveCSS / Data URI Text
Browser supportUniversal (Web + OS)
OpenType GSUB/GPOSYes

Strengths

  • Eliminates extra font network round-trips for single-file HTML emails, exports, or extensions
  • Zero external asset URLs or CORS headers needed
  • Stays very compact (~5–15 KB) when paired with HarfBuzz character subsetting before encoding

Trade-offs

  • Base64 text encoding adds ~33% raw byte overhead before HTTP gzip/Brotli transport compression
  • Blocks CSS parsing if used with large un-subsetted fonts instead of external preloaded WOFF2
  • Cannot leverage independent browser font cache across CSS revisions

Convert & optimize Base64 Data URI locally

Related engineering guides

All 18 guides

Base64 Data URI frequently asked questions

When should I Base64-encode a font into CSS vs linking an external .woff2?

Use Base64 for self-contained single-file HTML templates, offline WebViews, or tiny <10 KB subsetted fonts. For regular sites, preloaded external WOFF2 is faster.

Why does FontTo offer 'Subset before Base64 encode'?

Because Base64 expands binary size by 33%, stripping unused glyphs first shrinks a 112 KB TTF down to ~6 KB subsetted WOFF2 before embedding.

What Data URI MIME type should Base64 WOFF2 use?

Use data:font/woff2;base64,... inside @font-face with format('woff2').

Authoritative References

Explore other font formats

All 12 formats →