Base64 in HTML <style>

Inside a <style> element you can use data URIs anywhere CSS accepts url().

Example

<style>
  .logo { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAK...") no-repeat; width: 16px; height: 16px; }
  @font-face { font-family: Icons; src: url("data:font/woff2;base64,d09GMgABAAAAA...") format("woff2"); }
</style>

Notes

  • Embedding fonts as Base64 avoids a flash of unstyled text but increases CSS size considerably.

Other HTML tags

Related tools and guides

Comments (0)

Questions, ideas or a bug in “Base64 in HTML <style>”? Leave a comment, rate the tool, or reply to others.

No comments yet. Be the first to share your feedback!

Leave a comment

Rate this tool:
Esc
↑ ↓ move↵ openEsc close