How browser-based image compression works
When you add an image, your browser decodes it into raw pixels and draws them onto an off-screen canvas. The canvas is then re-encoded to the format you pick. JPEG and WebP are lossy formats: the quality value tells the encoder how aggressively it may discard fine detail the eye is unlikely to notice. Around 70 to 85 is a sensible range for photographs, and values below 50 usually introduce visible blocking or smearing.
PNG is lossless, so the browser has no quality dial for it. Re-encoding a PNG may produce a smaller or a larger file depending on how the original was saved. If you need a much smaller file from a PNG photo, exporting to WebP or JPEG is usually far more effective.
Limitations worth knowing
Compression is not guaranteed to make every file smaller. An image that was already optimized by a camera or another tool can grow when re-encoded, and this tool tells you when that happens instead of hiding it. Re-encoding also removes most metadata such as EXIF camera details and GPS location, which is often a privacy benefit. Animated GIF or WebP files are flattened to their first frame. Very large images, roughly above 40 megapixels, may exceed the canvas limits of some mobile browsers.