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.
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 guidesProduction @font-face CSS: Preload, crossorigin, and font-display Strategy
Write bulletproof @font-face CSS with font-display: swap vs optional, crossorigin preload hints, and metric-matched fallbacks for fast LCP.
Base64 Inline WOFF2 vs. External Font Files: When Data URIs Make Sense
Weigh Base64 Data URI fonts (+33% overhead and CSSOM blocking) against external WOFF2 files—and learn when inline subsetting actually wins.
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').