Drop an image here
PNG, JPEG, WebP, GIF, BMP or SVG
The converted image appears here.
Convert an image between PNG, JPEG and WebP, resize it, and compress it, all in the browser. A canvas in this tab does the work and nothing is uploaded, which matters when the image is a screenshot of a dashboard or a client's unreleased logo.
Drop an image here
PNG, JPEG, WebP, GIF, BMP or SVG
The converted image appears here.
Pick WebP unless something forces another format. It is roughly 25 to 35% smaller than JPEG at the same visual quality, supports transparency, and every current browser reads it.
Use it when something old or non-web has to open the file. JPEG has no transparency, so the tool composites transparent pixels onto the background color you choose (white by default).
Lossless, so use it for screenshots of text, diagrams and anything with flat color and hard edges. For photographs it is several times larger, and the quality slider has no effect.
Smaller still, but encoding is slow and the browser canvas cannot produce it, so this tool does not offer it. Use a build step such as sharp for AVIF.
The tool draws the image onto a canvas and encodes it again from the pixels. That has two consequences. First, all metadata is gone: EXIF location, camera model, timestamps and the copyright field. Before publishing a photo that is usually what you want; if you need the copyright field, add it back afterwards.
Second, each pass is lossy for JPEG and WebP. Converting a JPEG to WebP at 80 and back again does not return the original, and the losses add up. Always re-encode from the highest-quality source you have, never from a file you already compressed.
A canvas re-encode does not optimize the PNG stream the way oxipng or pngquant do, so a PNG that has already been through one of those tools will come out larger here. Converting a photograph to PNG also multiplies its size several times over, because PNG is lossless and a photograph has no flat regions to compress. If the size goes up, pick a different format for that image.
# sharp is the fastest option for a Node project
npx sharp-cli -i input.png -o output.webp --format webp --quality 80
# Resize and convert a whole folder
npx sharp-cli -i "src/*.{jpg,png}" -o dist/ resize 1200 --format webp
# ImageMagick, if it is already installed
magick input.png -quality 80 -resize 1200x output.webp
# Squeeze a PNG properly: a canvas re-encode cannot do this
npx oxipng -o 4 --strip safe image.png
npx pngquant --quality 65-85 image.png oxipng and pngquant optimize the PNG stream itself, which is why a browser-based tool can make an already-optimized PNG larger.
// createImageBitmap applies the EXIF orientation, which drawImage alone does not
const bitmap = await createImageBitmap(file, { imageOrientation: "from-image" });
const canvas = document.createElement("canvas");
canvas.width = 1200;
canvas.height = Math.round(1200 * bitmap.height / bitmap.width);
const ctx = canvas.getContext("2d");
ctx.imageSmoothingQuality = "high";
// JPEG has no alpha, so transparency needs something to land on
ctx.fillStyle = "#ffffff";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
const blob = await new Promise((r) => canvas.toBlob(r, "image/webp", 0.8)); <!-- The browser picks the first type it understands -->
<picture>
<source srcset="hero.avif" type="image/avif">
<source srcset="hero.webp" type="image/webp">
<img src="hero.jpg" alt="" width="1200" height="630" loading="lazy" decoding="async">
</picture>
<!-- width and height are not optional: without them the page
reflows when the image loads, which is most of your CLS score --> WebP is roughly 25 to 35% smaller than JPEG at matched visual quality and is supported by every browser in use. AVIF is smaller again, often by a wide margin on photographs, but encoding is slow and the browser canvas cannot produce it, so generate AVIF in a build step instead.
Re-encoding strips all metadata, which is usually what you want. A photo straight from a phone carries GPS coordinates, the camera model and a timestamp. Publishing it unprocessed publishes all of that.
This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.
No. The browser reads the file into a canvas in this tab and re-encodes it there, so nothing is sent over the network.
WebP for almost everything on the web: it is roughly 25 to 35% smaller than JPEG at the same quality, and every current browser supports it. Use JPEG when an older program has to read the file, and PNG only when you need lossless output, because PNG photographs are several times larger.
The original was probably compressed by a tool that optimizes the PNG stream, such as oxipng, and the canvas re-encode does not do that. Converting a photograph to PNG also inflates it, because PNG is lossless and photographs have no flat areas to compress.
PNG and WebP keep it. JPEG cannot store transparency, so the tool composites transparent pixels onto the background color you choose, white by default.
Yes, as a side effect of re-encoding. Location, camera model and timestamps are all removed, which is usually what you want before publishing a photo. The orientation flag goes too, so the tool rotates the pixels first.
Only your device's memory. A canvas holds the image uncompressed, so a 50-megapixel photo needs about 200 MB of RAM while it is being converted. Very large images may fail on a phone.
For vector files, use the SVG optimizer instead. To build a full icon set from one image, use the favicon generator, and to inline a small image in CSS, image to Base64.