html69// developer tools

How to Convert WebP to PNG (and PNG to WebP) in Your Browser

WebP to PNG Converter / PNG to WebP Converter

You right-click a graphic, hit Save image as..., and instead of a clean .png you get a .webp that an older editor, slide deck, or legacy workflow will not open. Or the other way: you are shipping a page and the unoptimized PNGs feel like bricks on a mobile connection.

You do not need bulky desktop software, and you do not need to upload the image to a random cloud. The WebP to PNG Converter / PNG to WebP Converter converts in this tab. We never see the file.

Convert WebP to PNG and PNG to WebP locally

Drop in a .webp or .png, pick To PNG or To WebP, and download the result. Preview sits on a checkerboard so transparency is visible. Mockups, unreleased product shots, and client assets stay on your computer.

Need a favicon next? Send the PNG through the PNG to ICO Converter - Favicon Generator. Want a data URI? Use the Image to Base64 Converter / Base64 to Image Converter. JPEG and SVG belong on that encoder or the SVG to Base64 & CSS Data URI encoder. Those tools also run on your computer.

WebP vs PNG: when each format makes sense

Both formats keep an alpha channel, which is what you want for logos, badges, and UI cutouts. Each has a job:

FormatWhat it is for
PNGLossless. Crisp icons, diagrams, text-heavy screenshots.
WebPSmaller files for photos and complex web graphics. Alpha too.

A quick reality check on quality

Nobody likes a surprise after download. Here is what conversion actually does:

  • WebP to PNG. The converter decodes the WebP and writes a lossless PNG. No extra generation loss in that step. If the original WebP was already lossy, PNG cannot invent detail that is gone.
  • PNG to WebP in this tab. The quality slider encodes lossy WebP through canvas (default 80). Raise it if a gradient bands. True lossless WebP is a CLI job with cwebp -lossless.
  • Animated WebP. Canvas reads the first frame. The download is a still PNG or WebP, not an animation.

How to convert WebP and PNG by hand

The converter is the fast path when you have assets to flip before lunch. Canvas and CLI still help in scripts, build pipelines, and one-offs.

1. Convert in JavaScript with canvas

Modern browsers can decode and encode PNG and WebP on an HTML5 <canvas> without sending bytes over the network:

JavaScript

function convertImageElement(img, mimeType = "image/png", quality = 0.92) {
  return new Promise((resolve, reject) => {
    const canvas = document.createElement("canvas");
    canvas.width = img.naturalWidth || img.width;
    canvas.height = img.naturalHeight || img.height;

    const ctx = canvas.getContext("2d");
    if (!ctx) {
      reject(new Error("Could not initialize 2D canvas context"));
      return;
    }

    ctx.drawImage(img, 0, 0);

    canvas.toBlob(
      (blob) => {
        if (!blob) {
          reject(new Error("Image conversion failed"));
          return;
        }
        resolve(blob);
      },
      mimeType,
      quality
    );
  });
}

Pass "image/png" to turn a loaded WebP into a PNG blob. Pass "image/webp" with a quality between 0 and 1 (for example 0.85) to encode a PNG as WebP. Leave the canvas clear so transparency is not painted over.

2. Convert in the terminal

Google's WebP tools and ImageMagick cover most local pipelines:

dwebp / cwebp

# WebP to PNG
dwebp photo.webp -o photo.png

# PNG to WebP (quality 0-100; use -lossless for lossless WebP)
cwebp -q 85 image.png -o image.webp

ImageMagick

# WebP to PNG
magick photo.webp photo.png

# PNG to WebP
magick image.png -quality 85 image.webp

3. Check transparency before you ship

Whenever you convert images with transparent backgrounds, look at the edges:

  • Semi-transparent shadows and anti-aliased edges should not pick up a harsh halo. The converter's checkerboard preview is there for that.
  • If the file size drops a lot and it still looks crisp, you are in good shape. If a gradient or fine detail bands at a low quality, bump the slider or keep PNG.

Convert WebP to PNG or PNG to WebP in the WebP to PNG Converter / PNG to WebP Converter, or wire it up yourself with canvas and CLI tools. The conversion stays on your computer. We never see the files.

All blog posts