How to convert WebP to Base64
- Drop a
.webpfile on the box or choose it with the file picker. - To change format, pick PNG or JPEG under Convert to. With Keep format, setting a Max width re-encodes it as WebP at the chosen Quality.
- Pick Output as. The default is a data URI.
- Press Copy output. The meter compares input and output size.
Why WebP is a good fit for data URIs
Base64 adds about a third to whatever it encodes, so the smaller the source, the better. Lossy WebP is usually smaller than a JPEG of similar quality, and lossless WebP is often smaller than PNG while keeping transparency. For icons, product thumbnails and placeholders that you want inline, WebP usually gives a shorter string than PNG or JPEG.
Animated WebP files are encoded as they are. As with GIF, the re-encode options draw only the first frame, so leave them alone if the image moves.
When the destination does not take WebP
Plenty of software still expects PNG or JPEG: some APIs that accept Base64 images, older desktop programs, document generators and many email clients. Instead of converting the file somewhere else first, choose Convert to PNG or JPEG here and encode the result directly:
- PNG keeps transparency and every pixel, at a larger size.
- JPEG is smaller for photos, but fills transparent areas with white.
The file name in the HTML <a download> and JSON outputs changes to match the new format, for example banner.webp becomes banner.png.
Re-encoding to WebP in your browser
Most browsers can write WebP from a canvas, so resizing a WebP or changing its quality keeps it WebP. Safari cannot. There the tool falls back to PNG and says so under the preview, and a PNG of a photo can be several times the size of the WebP you started from. Use Chrome, Edge or Firefox if you need WebP output, or keep the original file.
Spotting WebP in Base64
WebP uses the RIFF container, the same one as WAV audio and AVI video:
UklGRlAAAABXRUJQVlA4IEQAAAD...
└─┬─┘└─┬──┘│└─┬┘
RIFF size W EBP
UklGR only says “RIFF”. The format tag WEBP sits at bytes 8 to 11 and shows up as XRUJQ at characters 12 to 16, followed by VlA4 for the VP8 chunk. If you are matching formats in code, check both parts. More signatures are listed in common Base64 prefixes, and Base64 to WebP decodes a string back into a file.
FAQ
Do all browsers display WebP data URIs?
All current browsers do. Safari supports WebP from version 14 on macOS 11 Big Sur or newer, and iOS from version 14. Older Apple systems show a broken image.
How can I tell WebP Base64 from WAV Base64?
Both are RIFF files and start with UklGR. In WebP, characters 12 to 16 read XRUJQ (from WEBP); in WAV they read XQVZF (from WAVE).
Why did I get a PNG when I asked for WebP?
Your browser cannot encode WebP from a canvas. Safari is the main case. The tool notes the fallback and gives you a PNG, which is lossless but usually larger.