By Usama Farooq · Published 1 Dec 2026
How Image Format Conversion Works Under the Hood
Converting an image format means decoding the original file back into raw pixels, then re-encoding those pixels with a different compression method. The picture itself does not change — only how its pixels are stored. That is why the same photo can be 200 KB as a JPEG and 60 KB as a WebP.
Try the free Image Format Converter
Use ToolsOfWeb's Image Format Converter to convert JPG, PNG and WebP in your browser — no upload, no sign-up, and your files never leave your device.
What actually happens when you convert an image format?
Conversion has two steps: decode, then encode. The decoder reads the original file — its header, colour data and compressed pixel data — and rebuilds the full grid of pixels in memory. The encoder then takes that pixel grid and writes it out again using the target format's rules, compressing it lossily or losslessly depending on the format you chose.
In memory, that pixel grid is uncompressed: a 1200 by 800 photo holds 960,000 pixels, each needing three or four numbers for colour and transparency — about 3.8 MB of raw data. The encoder's job is to squeeze that grid back down, and each format squeezes differently.
How do JPEG, PNG and WebP store pixels differently?
JPEG stores photos as compressed blocks of colour using the discrete cosine transform, discarding detail your eyes barely notice. PNG stores every pixel exactly, using lossless DEFLATE compression. WebP does both: it uses VP8-style predictive coding for lossy photos and a dictionary method for lossless graphics — which is why it is usually smaller than either.
JPEG dates to 1992 and was built for photographs. It splits the image into 8 by 8 pixel blocks, converts each block from colours into frequencies with the discrete cosine transform, then throws away the high frequencies first — the fine detail your eyes notice least. The result: tiny files, and no transparency — JPEG has no channel for it.
PNG arrived in 1996 as a patent-free replacement for GIF and takes the opposite approach: it predicts each pixel from its neighbours, stores only the difference, then compresses the result with DEFLATE, the algorithm behind ZIP files. Nothing is thrown away, so a PNG survives a hundred saves without loss — but a detailed photo as PNG is usually several times larger than the same photo as JPEG.
WebP, announced by Google in 2010, is the hybrid. Its lossy mode borrows predictive coding from the VP8 video codec: it guesses each block from the blocks around it and stores only the correction. Its lossless mode reuses pixel patterns it has already seen. The payoff is measured: Google for Developers reports lossless WebP 26% smaller than PNG, and lossy WebP 25 to 34% smaller than comparable JPEGs at equivalent quality.
| Format | Compression | Transparency | Best for | Year |
|---|---|---|---|---|
| JPEG | Lossy | No | Photos | 1992 |
| PNG | Lossless | Yes, full alpha | Logos, screenshots, graphics | 1996 |
| WebP | Lossy and lossless | Yes, full alpha | Web photos and graphics | 2010 |
Why does converting JPEG to PNG not improve quality?
Because conversion can only re-package the pixels it is given — it cannot recover detail the JPEG encoder already threw away. A JPEG-to-PNG conversion stores the same damaged pixels losslessly, so the file gets bigger while the picture looks identical. Quality can only stay the same or get worse with each lossy step, never better.
This surprises people because the PNG file is bigger, and bigger feels like better. It is not: the JPEG encoder already discarded the fine detail when the photo was first saved, and no converter can invent it back.
The same rule applies the other way, and that is where real damage happens. Every JPEG save throws away a little more: edit a JPEG and save it again, and you have added a second round of loss. Do it five times and the blocky artefacts show. This is generation loss, and it is why professionals keep a lossless master — a PNG or TIFF — and export a JPEG or WebP only once, at the very end.
What happens to transparency when you convert to JPEG?
JPEG has no alpha channel, so transparent pixels must be filled with a solid colour — usually white — before saving. The picture keeps its shape, but the see-through areas become opaque. If you need transparency, convert to PNG or WebP instead: both store an alpha channel and keep every see-through pixel intact.
Transparency is a fourth number stored alongside red, green and blue: the alpha channel. It says how see-through each pixel is — 0 is fully invisible, 255 is fully solid, and anything between is partly see-through. PNG stores a full 8-bit alpha channel; GIF stores only one bit — visible or invisible — which is why GIF edges look jagged.
JPEG stores only red, green and blue, so there is nowhere to put the alpha numbers. A converter paints them over a background colour instead — white by default. That is what the ToolsOfWeb converter does: choose JPEG output, pick the fill colour, and every transparent pixel becomes that colour. That is why a logo gains a white box when converted to JPEG.
How does a browser convert images without uploading them?
The browser decodes the file with its built-in image decoder, draws the pixels onto a canvas element, then asks the canvas to export them as a new format with toBlob(). Everything happens in your device's memory — the file never leaves your computer, which is why the conversion works offline and stays private.
First the browser reads the file and decodes it with the same decoder it uses to show pictures on web pages — it already knows JPEG, PNG, WebP, GIF and BMP. Then it draws the decoded pixels onto an off-screen canvas at the original width and height.
Then comes the conversion: one call, canvas.toBlob(), with the target format and a quality number. The browser's encoder writes the pixel grid out as a JPEG, PNG or WebP file. The result is offered as a download link — nothing is sent anywhere, nothing is stored, and closing the tab wipes the data.
That is how the free Image Format Converter on this site works: it accepts JPG, PNG, WebP, GIF and BMP, converts up to five at once between JPG, PNG and WebP, and lets you set the quality and the JPEG background fill colour. Two honest limits: an animated GIF converts as its first frame only, and if a browser cannot encode WebP, the tool says so instead of failing silently.
FAQs
No. Conversion keeps the width and height the same — only the file format and compression change. What changes is the file size: the same photo might be 300 KB as a JPEG, 900 KB as a PNG and 180 KB as a WebP. If you want smaller dimensions, resize the image first, then convert it.
Use WebP for most web photos: Google reports lossless WebP is 26% smaller than PNG and lossy WebP is 25 to 34% smaller than JPEG at the same quality, so pages load faster. Keep JPEG as a fallback for very old browsers, and use PNG only when you need perfect quality or transparency on a graphic.
Yes. Open the image in a converter, choose JPG as the output and download the result — the browser decodes the WebP pixels and re-encodes them as JPEG. Remember JPG cannot store transparency, so see-through areas are filled with white. For photos with no transparency, the conversion is straightforward.
Yes, when the tool processes files locally. A browser converter decodes and re-encodes the image on your own device, so nothing is uploaded to a server and nothing is stored after you close the tab. Check that the tool says no upload — if it asks you to upload first, your image travels to someone else's server.
Because PNG is lossless: it stores every pixel exactly, while JPEG throws away detail your eyes barely notice. A photo saved as PNG can easily be three to five times larger than the same photo as JPEG. That is normal — use PNG for logos and screenshots, and JPEG or WebP for photos.
Try the free Image Format Converter
Open the Image Format Converter and convert JPG, PNG and WebP in your browser — no sign-up, your files never leave your device.
If you liked this explainer, read how HEIC to JPG conversion works under the hood. For smaller files without changing format, try the Image Compressor.
