GIF to WebP

Published Updated

Re-save an animated GIF as an animated WebP, with every frame stored as a lossy still at quality 92 and the delays and transparency kept. A photographic test GIF came out 35% smaller; a flat cartoon came out 35% larger.

When it shrinks and when it grows

The result depends on what is in the GIF. Both samples were converted in Google Chrome 156 with the tool's own decoder and muxer:

Test GIFGIF sizeWebP sizeChangePer frame
Photographic pan, 36 frames, 480 x 2702,784,074 B1,810,386 B35% smallerabout 51 KB
Flat cartoon, 30 frames, 400 x 30041,022 B55,222 B35% largerabout 2.3 KB

The WebP overview says animated WebP can reduce size compared with GIF; the second row shows that it does not always do so. If you only need a smaller GIF, Compress GIF to Size keeps the format.

What carries over from the GIF

  • Frames and size: every frame, at the same width and height; nothing is resized.
  • Timing: the delay of each frame, in 1-millisecond units as the WebP container specification defines them.
  • Transparency: the GIF's single clear color becomes true per-pixel alpha in each frame.
  • Not carried: the loop count (always infinite), comments, and the GIF's exact , since frames are re-encoded as lossy pictures.

Five GIFs through the converter, browser by browser

We ran this page's own converter on five generated GIFs in Chrome 156, Chromium 153 (Playwright build, not Google Chrome), Firefox 155 and Playwright's WebKit build (not the Safari app), one run each, and took the WebP from the page's download link. Size of the WebP, with the time from Convert to the finished file:

Test GIFGIF sizeChrome 156Chromium 153Firefox 155WebKit build
Grainy photo-like pan, 36 frames, 480 x 2702,784,074 B1,810,386 B, 0.84 s1,810,386 B, 0.78 s1,812,684 B, 1.50 sNo file: the page's no-WebP-encoder message
Flat cartoon, 30 frames, 400 x 30041,022 B55,222 B, 0.20 s55,222 B, 0.17 s55,268 B, 0.21 sSame message
Transparent background, 6 frames, 200 x 2003,342 B2,692 B2,692 B2,536 BSame message
Four solid frames, played once782 B516 B516 B516 BSame message
Delays of 0, 10, 20, 70 and 1,000 ms995 B624 B624 B624 BSame message

In the three engines that made files, the converter wrote the same structure: every frame at full size (VP8 data, plus an ALPH chunk where the frame had transparency), each frame's delay copied in milliseconds (80, 60, 100, 500, and 100, 10, 20, 70, 1,000; the stored 0 became 100), and a loop count of 0 for all five, the GIF that played once included. The WebP container specification says of the loop count: "If it is 0, this means infinitely."

Read back with each browser's own decoder (ImageDecoder), the frame counts matched the GIFs, and the transparent corner of the third GIF stayed transparent in Chrome 156, Chromium 153 and Firefox 155. The file header marks the animation as having transparency when any frame has it, which the specification asks for ("Set if any of the frames of the image contain transparency information"), and the Pillow image library (11.3.0, with libwebp 1.5.0) then also read the background as transparent. One difference: for the 10 ms frame Chrome 156 and Chromium 153 reported 10 ms, while Firefox 155 reported 100 ms. The specification leaves very short durations to each program ("the interpretation of the Frame Duration of 0 (and often <= 10) is defined by the implementation"); we did not time playback.

Converting a GIF

  1. Step 1

    Drop an animated GIF

    The file is decoded straight away, so a GIF over the limits is turned down with a message before you press anything.

  2. Step 2

    Press Convert

    Each frame is drawn on a canvas and saved as its own WebP picture. A percentage shows how far it has got.

  3. Step 3

    Download the WebP

    The card names the width, height and frame count of the new file, with a preview on a checkerboard.

Where the file will play

MDN image format guide gives 16,383 x 16,383 pixels as the largest WebP, which the tool's 10,000-pixel input limit stays under. The WebKit build cannot make these files, but in our test it opened WebP files made here in Chrome 156 with the frame counts intact (it reported the 10 ms frame as 100 ms, as Firefox 155 did), and showed the transparent background as transparent in an image element. Many apps still accept only GIF, so keep the original.

The 36-frame, 480 x 270 GIF took 0.84 seconds to convert in Chrome 156, 0.78 seconds in Chromium 153 and 1.50 seconds in Firefox 155. If a site plays video better than animated pictures, GIF to MP4 is the other route.

GIF to WebP questions

Why did my WebP come out bigger than the GIF?

Every frame is stored whole, as a separate lossy picture, and nothing is shared between frames. A GIF made of flat colors, where most pixels repeat from frame to frame, can compress better than that. The 30-frame cartoon here grew from 41,022 to 55,222 bytes.

Is the animation speed the same?

The delays are copied: each frame's delay is read from the GIF and written in milliseconds, the unit the WebP container uses, and a delay stored as 0 is written as 100 ms. In our test the written delays matched the GIF's in all three browsers that made files. Read back, Firefox 155 and the WebKit build reported a 10 ms frame as 100 ms, while Chrome 156 and Chromium 153 reported 10 ms; we did not time how fast each browser plays it.

Will a GIF that plays once still play once?

No. The loop count is written as 0, which the WebP specification defines as looping forever. The GIF's own count is not carried over.

Is the quality adjustable?

No, it is fixed at 92%, with no slider. Colors are no longer limited to 256 in the new file, though the GIF's original palette already limited what the frames contain.

What GIFs does it refuse?

Those with more than 1,000 frames, more than 10,000 pixels on a side, or more than 500 MB of decoded pixel data. A message names the limit. Files that are not valid GIFs are also turned down.

Can I make the WebP in Safari?

In the WebKit build the canvas handed back PNG pictures when the tool asked for WebP frames, so the tool stopped with its message and saved nothing, for all five of our test GIFs. Chrome 156, Chromium 153 and Firefox 155 made the files. The WebKit build did open files made here in Chrome 156, including the transparent background.

Does the WebP keep the transparent background of my GIF?

In our test, yes. The GIF's clear colour became real transparency in every frame (an ALPH chunk per frame), and the corner stayed transparent when Chrome 156, Chromium 153 and Firefox 155 decoded the file. The file header also carries the transparency flag, so the WebKit build (in an image element) and the Pillow image library showed the background as transparent too. Partly transparent edges are not possible in a GIF, so there were none to keep.

Why is the WebP from Firefox a little different in size?

Each browser has its own WebP encoder for the frames. The 36-frame pan came out 1,810,386 bytes in Chrome 156 and Chromium 153 and 1,812,684 bytes in Firefox 155, and the transparent GIF 2,692 against 2,536 bytes. The frame count, delays and loop setting were the same.

How long does a conversion take?

Under two seconds for our largest test. The 36-frame, 480 x 270 pan took 0.84 seconds in Chrome 156, 0.78 in Chromium 153 and 1.50 in Firefox 155, and the 30-frame, 400 x 300 cartoon 0.17 to 0.21 seconds. Frames are encoded one after another while the button shows a percentage.

Related guide

Making a GIF from a video: size, frame rate and quality. The guide compares animated WebP with GIF, including the flat cartoon case where WebP came out larger.

Related Tools