Compress Image
Operator: Abdulla Al Fahad. How tools are built and checked
A photo straight off a phone is often several megabytes, because the camera saves it at a very high JPEG quality and full sensor resolution. Job portals, visa forms, marketplaces and email clients cap uploads too, and many forms set a limit of a few hundred KB. Compress Image closes that gap by decoding the picture in your browser, optionally scaling it down, and saving it again at a lower quality setting, either one you pick on a 10 to 100 slider or one the tool finds for a size you type in.
Compress Image reads each file's header first and refuses anything above 50 megapixels before decoding it, and in Target size mode it searches quality levels for the highest one that fits your limit. Server-based compressors upload the file to do this; here the decode and the re-encode happen on a canvas inside the tab. The trade-off is that the tool can only use the encoders your browser ships, which matters for WEBP and for PNG, as explained below.
Key features
- Quality slider from 10 to 100 for JPG and WEBP, defaulting to 80.
- Target size in KB or MB, found by a binary search over quality between 0.05 and 0.95: seven encodes, plus one at 0.05 if none of them fits.
- Output as the same format as the input, or switched to JPG, WEBP or PNG for the whole batch.
- Optional maximum width and height that keep the aspect ratio and never enlarge an image.
- Background colour for transparent pixels when the output is JPG, white by default.
- Per-file original size, new size and percentage saved, with a warning and a Keep the original option when the new file is not smaller.
- Up to 50 images of 25 MB and 50 megapixels each, downloaded one by one or together as a ZIP.
- EXIF rotation applied, EXIF and GPS data left out of every re-encoded file.
JPG and WEBP are lossy formats with a quality knob. Lower quality throws away fine detail the eye is less sensitive to, mostly subtle colour variation and texture in busy areas, and the file shrinks steeply at first and then more slowly. Going from the very high quality a camera uses down to about 80 usually saves a lot; going from 80 to 60 saves noticeably less and starts to show blocky 8 × 8 squares in skies and smeared edges around text. WEBP is often smaller than JPG at a similar look, depending on the image, though the two quality scales are not exactly comparable.
PNG is lossless: every pixel comes back exactly, so there is no quality setting to lower. The browser's PNG encoder also does not reduce the palette or try the heavy optimisation passes that dedicated PNG tools use, so a PNG saved here usually ends up about the same size as before and can be larger. For a PNG, the useful levers are a smaller maximum width and height, or switching the output to WEBP (which keeps transparency) or JPG (which does not).
Every re-encoded file is written from the decoded pixels alone. EXIF fields such as camera model, capture time and GPS coordinates are not copied, and neither is any embedded colour profile; the canvas works in sRGB. The rotation flag is applied before drawing, so a portrait photo that was stored sideways with an orientation tag comes out upright. If you tick Keep the original for a file, that file is passed through byte for byte with all of its metadata.
How it works
Each file is first sniffed: the tool reads its header to find the real format and pixel dimensions. For a JPEG whose size marker is not in the first 512 KB, for example behind a large EXIF thumbnail, it scans the whole file. Anything above 50 megapixels is refused before the browser decodes it, since a decoded image takes 4 bytes per pixel, and a file over 20 MB whose size could not be read is refused too. It then decodes the image with createImageBitmap, asking for the EXIF orientation to be applied, or with an image element in browsers where that call fails.
If you set a maximum width or height, the scale factor is the smaller of the two ratios, capped at 1. Large reductions are drawn in halving steps (4000 to 2000 to 1000, then to the final size) so fine patterns do not turn into moiré in browsers that draw with basic smoothing. For JPG output the canvas is filled with your background colour before the photo is drawn on top.
In Quality mode the canvas is encoded once at your setting. In Target size mode the tool encodes at the midpoint of 0.05 and 0.95, keeps the upper or lower half depending on whether the file fitted, and refines six more times, seven encodes in all, which narrows the quality down to within about 0.01. The highest quality that fitted is kept. If none fitted, it makes an eighth encode at 0.05 and shows you that size with a warning. Finally it checks the type of the blob the browser returned, so a file is never labelled WEBP unless the browser really wrote WEBP.
Common use cases
- A graduate applying through a careers portal has a 4.2 MB headshot and a 500 KB limit; Target size at 500 KB with a 1200 px maximum width gets it accepted on the first try.
- A seller listing twenty items on a marketplace compresses all the product shots at quality 80 in one batch and downloads them as a single ZIP.
- Someone emailing holiday photos to a relative whose inbox rejects attachments over 10 MB sets Target size to 1 MB and brings eight 4 MB pictures under it.
- A small-business owner replacing the hero images on a website converts 2.5 MB JPGs to WEBP capped at 1920 px wide, with Target size set to 300 KB.
- A parent sharing school photos in a group chat wants the GPS location in the files gone; re-encoding removes it without changing how the pictures look.
How to use this tool
- Drop JPG, PNG or WEBP files onto the box, or press Enter on it to open the file picker. You can add more files later, up to 50.
- Choose the output format. Same as input keeps each file's format; JPG, WEBP or PNG applies to the whole batch.
- Pick Quality and move the slider, or pick Target size and type a number with KB or MB.
- Optionally type a maximum width and height in pixels.
- If the output is JPG and any image has transparency, check the background colour.
- Click Compress images and read each row: sizes, percentage saved, final dimensions and the quality used.
- Download single files from their rows, or use Download all to get a ZIP when there is more than one.
Example
A 4000 × 3000 phone photo of a street scene, 4.1 MB JPG
Same as input, Quality 80, no resize
Same as input, Quality 80, max width 1920
WEBP, Quality 80, max width 1920
PNG, no resize
Target size 300 KB, max width 1920What to expect (exact sizes depend on how much detail the photo has)
JPG 4000 × 3000 at quality 80: smaller than the original, by an amount that depends on the photo
JPG 1920 × 1440 at quality 80: much smaller again, since under a quarter of the pixels remain
WEBP 1920 × 1440 at quality 80: often smaller than the JPG at the same size
PNG 4000 × 3000: larger than the original JPG, because PNG is lossless
JPG 1920 × 1440 in Target size mode: at or under 300 KB, at the highest quality found that fitsTips for best results
- Resize first, then compress. A 4000 × 3000 photo shown in a 1200 px wide column carries more than ten times the pixels anyone will see, and no quality setting saves as much as dropping those pixels.
- For photos, start at 80 and compare the result with the original at 100 percent zoom on a sky or a face. If you cannot see a difference, try 70.
- Use Target size when a form states a hard limit, and set the target a little under it, say 480 KB for a 500 KB cap, because some sites count 1 MB as 1,000,000 bytes while this tool counts 1 KB as 1,024 bytes.
- Screenshots of text and interface elements compress badly as JPG; keep them as PNG and set a maximum width, or try WEBP at 90.
- Leave the background at white for logos going onto a white page. For a dark website, pick the site's background colour so the edges of the logo blend in.
Common pitfalls
Compressing a JPG that has already been compressed hard rarely helps much and can make it larger, because the encoder is re-describing blocky artefacts as if they were detail. The result row warns you when this happens and lets you keep the original instead.
Choosing JPG for a PNG with a transparent background fills the transparent area with the background colour. That is permanent in the new file; keep the PNG or use WEBP if you still need the transparency.
A target that is too small for the image cannot be met by quality alone. The tool stops at quality 5 and reports the size it reached; add a maximum width and height to go further.
A file over 20 MB is refused before decoding when its pixel size cannot be read from the header, because the tool cannot check it against the 50-megapixel limit first. Re-saving it as a standard JPG or PNG usually fixes this.
Re-encoding drops the colour profile. Photos shot in Display P3 on recent iPhones can look very slightly less saturated in the copy.
Common errors and how to fix them
- "This image is 9000 × 6000 (54.0 megapixels). The limit is 50 megapixels"
- Very large panoramas and scans would need hundreds of megabytes of memory to decode in a browser tab. Scale the image down in a desktop editor first, or split a panorama into parts.
- "Even the lowest quality tried (5) gives 612 KB, above the target"
- The image has too many pixels for the target. Set a maximum width, for example 1600 px, and run it again; halving the width roughly quarters the size.
- The new file is larger than the original
- The original was already compressed hard, or you chose PNG for a photo. Tick Keep the original for that file, lower the quality, or set a maximum width.
- "This browser cannot save WEBP images"
- In browsers without a WEBP encoder, Compress Image saves those files as JPG instead, labels them JPG, and the result row says so. Open the page in a browser that can write WEBP if you need WEBP output.
- "The pixel size of this ... MB file could not be read before decoding, and files over 20 MB are only opened when it can"
- The header did not give the image's dimensions, so the tool could not confirm it is under 50 megapixels before decoding. Re-save it as a standard JPG or PNG in an image editor, or reduce it below 20 MB, and try again.
- A HEIC photo from an iPhone is refused
- This version cannot read HEIC. On the iPhone, set Settings > Camera > Formats to Most Compatible, or export the photo as JPG from the Photos app, then compress the JPG.
Best practices
- Keep your original files. A small icon or an already heavily compressed JPG can come out larger after re-encoding, and a compressed JPG cannot be turned back into the full-quality one.
- Match the pixel size to where the picture will be shown: about 1200 to 2000 px wide for a full-width web image, 800 px for an email, and whatever an upload form specifies for ID photos.
- Prefer WEBP for images on your own website, and JPG for files you will send to other people, since some older software and upload forms still refuse WEBP.
- Check a compressed photo at 100 percent zoom before sending it somewhere it will be printed; artefacts invisible on a phone show up on paper.
Why quality 80 is a sensible default
Camera apps typically save at a very high JPEG quality. Most of the extra bytes at that level describe noise and texture differences that are hard to see on a screen. Around 80, a photo of people, buildings or landscapes usually looks the same as the original at normal viewing size while weighing much less.
Below 60, the encoder's 8 × 8 pixel blocks start to show in smooth gradients such as a blue sky, and sharp edges, especially text in the photo, pick up a faint ringing halo. Images with lots of fine detail, like foliage or gravel, hide these artefacts better than flat ones, which is why the same quality number gives very different sizes on different photos.
What happens to metadata
Because each output file is written by the canvas from raw pixels, it contains only what the encoder adds: the image data and a minimal header. Nothing from the original's EXIF block is carried across, so the camera make and model, the lens, the date and time it was taken, the GPS position and any embedded thumbnail are all absent from the new file.
Two things to be aware of. First, a file you keep as the original with the checkbox is untouched and still has all of its metadata. Second, removing metadata does not remove what is visible in the picture itself, such as a house number or a car registration plate.
- Removed from re-encoded files: EXIF camera and lens data, capture date, GPS coordinates, embedded thumbnails, ICC colour profile, XMP and IPTC fields.
- Applied before removal: the EXIF orientation, so the picture keeps its correct rotation.
- Unchanged: anything you choose to keep as the original.
Frequently asked questions
Why did my PNG barely get smaller?
PNG is lossless, so the quality slider does not apply, and the browser's PNG encoder does not do the palette reduction that specialised PNG optimisers use. Set a maximum width and height, or switch the output to WEBP to keep transparency at a much smaller size. If your browser cannot write WEBP, those files are saved as JPG, which fills transparent areas with the background colour; for a transparent image in that browser, keep PNG output.
How accurate is Target size?
When the target can be reached, the file is always at or under it, usually only slightly below it. The search tries seven quality levels, so it stops within about one quality step of the best possible setting.
Does compressing remove the location from my photo?
Yes for every file the tool re-encodes, because the new file is written without the original's EXIF data, which is where GPS coordinates are stored. A file kept as the original with the checkbox still has its location.
Can I compress HEIC or GIF images?
Not with this tool. HEIC is not supported in this version, and GIFs are not accepted because re-encoding would keep only the first frame. Convert Image can turn the first frame of a GIF into a PNG, JPG or WEBP.
Will the image be resized if I leave the size fields empty?
No. Empty fields mean no limit, and the image keeps its pixel dimensions. Even with limits set, an image smaller than both is left at its size; nothing is enlarged.