Image Compressor
Most compressors hand you a quality slider and leave you to guess which value comes in under the limit you were given. This one takes the limit as the input: type 500 KB and it encodes the picture at a run of qualities between 5 and 95, in at most eight tries, and keeps the highest quality it tried whose file came in under your number. It then tells you which quality that was, prints the exact byte count beside the size, and shows the before and after side by side. When even the lowest quality is over the limit it says so and hands back the smallest it managed, rather than quietly returning something over the target. The picture is decoded, drawn and encoded in this browser tab, so nothing is uploaded and there is no account.
Drop a picture here, or choose one below.
The compressed picture appears here.
· or drop one anywhere on the stage
No picture open yet. Choose one, or drop it on the stage.
A target is searched between quality 5 and 95, in at most 8 trial encodes, and the quality it settles on is the one shown. KB here means 1,024 bytes and MB means 1,024 KB, and the exact byte count is printed beside the size so there is nothing to guess at. Smallest for photographs. JPEG has no transparency, so a clear background is filled with the colour you pick.
Common questions
- How do I compress an image to a specific file size?
- Open the picture, set the Aim for control to Target size, and type the limit in the Target box: 500 KB, 0.5 MB, 250000 bytes or a bare number, which is read as KB. The tool encodes at quality 95 first and takes that if the file already fits. If it does not, it encodes at quality 5 to find out whether your number is reachable at all, and if it is, it bisects between the two, keeping the best quality whose encode came in under the limit. It uses at most eight trial encodes, which is enough to land within about one quality point of the best that fits. The quality it settled on appears in the heading of the After pane and in the line under the stage, along with the size in KB and the exact number of bytes.
- Which quality setting should I use?
- If you were given a file size limit, do not choose one: use Target size and let the search find it. Quality mode is for the other case, where you want a particular level of detail rather than a particular file size, and it takes a number from 1 to 100 that is passed straight to the browser's JPEG or WebP encoder. Around 80 is the usual compromise for photographs, and WebP is normally smaller than JPEG at the same number. The setting does nothing at all to a PNG, because PNG is lossless, and the tool says so rather than pretending the slider did something.
- Why did my PNG not get smaller?
- Because PNG is lossless. There is no detail to discard, so there is no quality to trade away: nothing in the picture is coarsened to make the file smaller. Keeping a PNG as a PNG here rewrites it with the browser's own PNG writer, which is not a PNG optimiser, so the file can come back much the same size or even a little larger. To make a photograph saved as PNG substantially smaller, change the output to JPEG or WebP, which is the conversion that actually removes bytes. Screenshots, drawings and flat colour are the cases where PNG is already the right format and there is little to win.
- What happens to a transparent image saved as JPEG?
- The tool asks you what to put behind it first. JPEG has no alpha channel, so transparency cannot be stored at all: some tools fill it with black without telling you. After decoding, this one reads the alpha channel a strip at a time, so a large picture never needs its whole pixel buffer at once, and the moment it meets a pixel that is not fully opaque it stops and asks for a background colour. White and black are one press each, and the colour well takes any other colour. WebP and PNG both keep transparency, so choosing either of those never raises the question.
- Is the image uploaded to compress it?
- No. The file is decoded by the browser, drawn onto a canvas in this tab and encoded back out here, both for the trial encodes the search makes and for the file you download. There is no server in this and no request is made: no image byte goes to an endpoint, to analytics or to error reporting. Nothing about the picture is written to your browser's storage either. The tool remembers three things between visits, what you are aiming at, the target you typed and the output format, and that is all it remembers.
- Is there a size limit on the file I can open?
- There is no limit on the file's size in bytes, because there is no upload to pay for: the practical ceiling is the memory of the device you are on. There is a limit on pixels, 25 megapixels, which is a browser limit rather than a policy of ours. Past roughly that size a canvas stops returning a drawable surface at all, so the tool names the picture's own megapixel count and the ceiling instead of handing back a blank file. Resize it first and then compress the smaller copy.
- How exact is the size it reports?
- It is the encoded file's own size, measured after the encode rather than estimated from it. The trial encodes during a search are counted from the base64 the browser returns, which carries three bytes in every four characters, and the file you download is then written once at the quality the search chose. The size shown beside the After pane is that file's size, and the line under the stage prints it again as an exact byte count next to the rounded KB, because KB here means 1,024 bytes and a limit written in decimal kilobytes would otherwise be out by about two percent.
The quality the search settled on and the size it reached are both exact and both shown. JPEG and WebP discard detail to get smaller, so a target size is reached by trying qualities, and a target that cannot be reached is stated rather than approximated.