Transparent WebP for Websites: How Alpha Channels Work

Transparent WebP for websites works in every current browser: WebP keeps an alpha channel in both lossless and lossy modes, so a cut-out PNG can shrink and still composite cleanly.

Key answers at a glance

Does WebP support transparency? Yes. WebP carries an alpha channel in both lossless and lossy modes, so transparent pixels stay transparent.

Can a transparent PNG become a WebP? Yes. The alpha channel survives the conversion unless the converter flattens the image onto a background color.

Does JPEG keep transparency? No. JPEG has no alpha channel, so transparent areas fill with whatever background the encoder was given, usually white or black.

Is transparent WebP smaller than PNG? Often. Lossy WebP compresses color data harder than PNG can, and the alpha channel is stored in a separate channel, so cut-out photographs shrink the most.

Do browsers show transparent WebP? Current versions of Chrome, Safari, Firefox, and Edge render it, alpha included. A fallback covers clients that predate WebP support.

What appears in the transparent areas? Whatever sits behind the image: the page background, a CSS gradient, a parent element's color, or the image element's own CSS background.

Does WebP support transparency?

Yes. WebP stores an alpha channel in both of its modes, lossless and lossy.

WebP is a container for two encoders. Lossless WebP reproduces every pixel, alpha included, the way PNG does, but with a newer compression scheme. Lossy WebP compresses the color channels and keeps the alpha channel intact, written losslessly in its own channel. That split lets a photographic cut-out give up a large share of its bytes without turning its edges ragged.

Workflow diagram for transparent webp for websites.

PNG has one mode: lossless. It keeps transparent PNGs exact, and it also keeps them heavy whenever the image holds photographic detail.

So transparency is not a reason to stay with PNG. It is a reason to pick the right WebP mode: lossless when every pixel must survive, lossy when the image can afford to lose some color detail.

How to create a transparent WebP

Create the file from a source that still has an alpha channel: a PNG, a layered design file, or a cut-out export. Then convert it without flattening the image onto a background.

Start from an alpha-capable source. PNG and layered design files keep an alpha channel; JPEG does not. If the artwork was ever saved as JPEG, the transparency is already gone, and no converter can recover it.

Export without a background. Turn off flattening, background color, and any matte option in the editor. A matte blends edge pixels toward one color, which produces a halo when the page background differs.

Keep alpha straight when the exporter offers the choice. Straight, or unassociated, alpha stores color and coverage as separate values, so the image composites cleanly on any background. Premultiplied alpha bakes one background into the edge pixels.

Convert with a tool that writes the alpha channel through. Editor export, a command-line encoder, or a batch app all work. The check is the output file, not the tool's label: open the converted WebP over a contrasting background and confirm the cut-out is still a cut-out.

Choose the mode deliberately. Lossless keeps the mask pixel-exact. Lossy keeps the same alpha channel but recompresses color, which is where the size reduction usually comes from.

On a Mac, one option in this workflow is Image2WebP, a Mac app from HP60 Studio that converts PNG and other image files to WebP in batches. Conversion runs on-device, so files never leave the machine, and the Pro tier preserves EXIF and GPS metadata during conversion.

Serving transparent WebP on a website

Serve the WebP file like any other image, and let the browser composite its alpha channel against what is behind it on the page.

The img element renders transparency against the page, not against a fixed color. Set a CSS background-color on the image element and that color fills the transparent regions instead; leave it unset and the page or parent element shows through.

A <picture> element is the portable way to offer WebP and keep a fallback for older clients:

<picture>
  <source type="image/webp" srcset="/images/logo.webp" />
  <img src="/images/logo.png" alt="Company logo" width="240" height="80" />
</picture>

A browser that understands WebP selects the first source. A browser that does not falls back to the PNG. Keep width and height on the image element so the layout does not shift while the file loads.

Check the response header as well. A WebP file served as image/png or application/octet-stream can be mishandled by proxies and by tools that download the file. The server should send Content-Type: image/webp.

AVIF also carries an alpha channel, so a <picture> list can offer whichever formats the site already produces: AVIF, WebP, PNG. Transparency survives in every one of them. Adding a source does not cost the alpha channel.

Common mistakes that break transparency

A flattened canvas, a JPEG in the pipeline, or a matte color at export explains most cases of lost or ragged transparency.

  • Saving to JPEG anywhere in the pipeline. JPEG has no alpha channel, so the first JPEG export replaces transparency with a solid color.
  • Leaving a background color or matte enabled. The halo is baked into edge pixels and shows up the moment the page background changes.
  • Trusting a converter that optimizes by flattening. Some pipelines drop the alpha channel to save bytes. Convert one file, inspect it, then run the batch.
  • Judging the result on a white page only. Compositing mistakes show up clearly over a dark background or a transparency checkerboard.
  • Serving the wrong content type. A WebP labeled as PNG may be re-encoded or rejected by an intermediary.
  • Resizing a cut-out without checking the edges. Resampling touches the alpha channel too, and thin edges such as hair or thread can fringe or disappear.
Editorial illustration for transparent webp for websites.

FAQ

Does converting PNG to WebP keep transparency?

Yes, when the source has an alpha channel and the converter does not flatten it. Lossless WebP keeps the alpha pixel-exact, and lossy WebP keeps the same alpha channel while recompressing color.

Is lossy WebP transparency as accurate as lossless?

The alpha channel is stored losslessly in both cases, so mask edges stay sharp. What changes in lossy mode is the color data inside the visible pixels. For flat graphics with hard edges, lossless avoids color artifacts next to those edges.

Does transparent WebP work in Safari?

Yes. Current Safari versions render WebP, alpha included, on macOS and iOS. A fallback is still worth adding when a site serves clients that predate WebP support.

Can a transparent WebP be converted back to PNG?

Yes. Converting WebP to PNG produces a PNG that keeps the alpha channel, which helps when a design tool or an older pipeline cannot read WebP. Converting the same file to JPEG would flatten the transparency, because JPEG has no alpha channel.

Why does my transparent WebP show a black or white background?

The alpha channel was dropped somewhere in the pipeline, most often by a JPEG export, a background color at export time, or a converter that flattens by default. Compare the original cut-out with the converted file to find the step that removed it.

What to check before publishing

Confirm that the alpha channel survived conversion, then confirm how the image composites on the backgrounds it will actually sit on.

  • Open the WebP over a contrasting background or a transparency checkerboard, not only over the page it was designed for.
  • Inspect the edges at full zoom on both a light and a dark background. Halos, fringes, and premultiplied mattes show up where contrast is highest.
  • Check the CSS on the image element. A background color set for layout reasons will fill the transparent regions.
  • Verify the Content-Type header on the WebP URL.
  • Load the page and confirm the browser picked the WebP source, then test the fallback path in a client that cannot decode WebP.
  • Keep the original source file. A flattened or matted conversion is easier to redo from the layered original than to repair after the fact.