How to reduce image file size without losing quality
Why a quality slider is a guess, and a target size isn't.
Strictly speaking, "compress without losing quality" is impossible for a lossy format — throwing away detail is the entire mechanism, that's what makes the file smaller. What people actually mean is compressing without visible loss, at the smallest size that gets away with it. Dragging a quality slider around until a preview looks fine is one way to chase that. It's not the way this tool does it, and the difference is worth explaining, because it changes what you should expect when a file comes back smaller than you asked for.
Why a quality percentage is the wrong lever
Set any image editor's export quality to 80% and the file size you get back depends almost entirely on the photo, not the number you typed. A cluttered, high-detail shot encodes to something several times larger than a flat, simple one at the identical setting. So 80% that comfortably clears an email attachment limit on one photo blows straight through it on the next. If there's an actual number you need to hit — a platform's upload cap, a page-speed budget — quality percentage isn't the right input at all. Byte count is.
Searching for quality, given a size
Flip the inputs and outputs around: give the search a target size, and it hunts for the highest quality that still fits under it. This tool does that with a binary search — try a quality level, check the result against the target, narrow the range, repeat — landing on the best-looking file that satisfies the number you set, guaranteed, rather than a number that happened to come out of a quality guess.
Quality has a floor, and crossing it isn't worth it
Push encoder quality low enough and it doesn't fail gracefully — past roughly 30 out of 100 for JPEG and WebP, color starts banding and blocky artifacts show up plainly, rather than the image just going a bit soft. A search that keeps lowering quality to force a tiny target through that floor makes a worse image, not a smaller good one. The right move once you hit that floor is a different lever entirely: shrink the pixels instead.
Cutting width by roughly 15% and re-running the quality search at that smaller size usually lands somewhere much better-looking than forcing quality below its floor at full size ever would. It's also the honest explanation for something that surprises people: an aggressive target on a large photo can come back at noticeably smaller pixel dimensions, not just a smaller file. That's the search doing its job, not losing your resolution by accident.
PNG doesn't play by any of these rules
Everything above only applies to lossy formats. PNG is lossless and has no quality setting to lower in the first place — its size lever is palette, the count of distinct colors it's allowed to keep. A target-size search for PNG trims the palette down instead of a quality number, which is also why it can be noticeably slower on a busy photographic PNG than on a plain graphic that only used a handful of colors to begin with. (More on when PNG is the right pick at all in the format guide.)
Don't compress a compressed file
One habit quietly undoes everything above: re-compressing a file that's already been through a lossy encode. The second pass throws away more detail on top of what the first pass already discarded — it doesn't start from a clean slate just because you asked for a different target this time. Keep the original around, and compress from that original each time you need a different size or format, not from last time's result.
Compress an image to an exact target size, or check current upload limits by platform if there's a specific cap you're aiming under.