Skip to main content
Home
NixNoob.com
  • Login
  • Home
  • Compress SVG
  • About
  1. Home

Embed WebP images in SVG

Sun, 04/13/2025 - 6:11am by regx

Although most vector programs such as Inkscape and Illustrator do not support embedding WebP compressed images in SVG, it is possible to embed webp in svg and most web browsers support it.

WebP offers amazing compression compared to png and jpg, has transparency support and is a great option for embedding images in svg.
To embed webp in svg you just need to base64 encode the webp image and include in your svg file. I find it easiest to embed the original png/jpg image and then update the xlink:href.

Original svg

xlink:href="data:image/png;base64,Base64-Encoded-PNG-data-here"

Updated svg

xlink:href="data:image/webp;base64,Base64-Encoded-WebP-data-here"

 Examples:

Original SVG with embedded png/jpg images Updated SVG with embedded webp images
Original SVG
Original SVG - 6.12 MB
Updated WebP SVG
WebP SVG - 340 KB

 I have created a free online tool that you can use to do this for you here: Free Online SVG Compressor

SVG
WebP
Graphics
Inkscape
Illustrator
File example1.svg
File example1_compressed.svg
  • Log in to post comments

Powered by Open Source Software