# Image Compressor

> Compress images to a target size like 200 KB, or by quality, with an optional max dimension. Side-by-side comparison with file size savings. JPG, PNG, WebP.

- Open the tool: https://overtooled.com/image-compressor
- Category: Image Tools
- Privacy: Runs entirely in your browser. Nothing is uploaded, no account is needed, and it works offline once loaded.
- Price: free, no sign-up
- Keywords: image, compress, reduce, size, quality, optimize, file

## In short

Reduce image file size while maintaining visual quality.

## Overview

Re-encodes an image as JPEG or WebP to fit a target file size (default 500 KB) or at a chosen quality, with an optional cap on the longest side. Changing a setting updates a side-by-side before/after preview about 400 ms later, along with the savings. The image is decoded once (upright, using its EXIF orientation) and re-encoded with the browser's canvas encoder on your device.

## Features

- Output JPEG or WebP
- Size: Target size (default) or Quality, switched without moving the controls below
- Target size: max file size typed in KB or MB (20 KB to 50 MB; met in decimal bytes, so "200 KB" is at most 200,000 bytes and passes forms that count either 200,000 or 204,800) or quick picks 100 KB, 200 KB, 500 KB, 1 MB, 2 MB -- the same field and picks as the File Converter
- Target search (shared with the File Converter, image-target.js): highest quality 30-95 that fits; if even quality 30 is too big, the image is resized (aiming for about quality 70, down to 320 px) and the result line says "Resized to WxH to fit 200 KB"; an unreachable target shows the smallest size reached and what to try, with no download offered
- A same-format image already under the target is kept as is ("Already under 500 KB, so the original is kept.")
- Quality slider 1-100 (default 75) in Quality mode
- Max Dimension: Original, 1920, 1280 or 800 px on the longest side; keeps aspect ratio and never upscales; in Target size mode it is the largest size the search may use
- Original and result dimensions shown under each size
- Live preview, updated 400 ms after any setting change; results for outdated settings are discarded
- Side-by-side before/after with sizes and savings (shows +% when the file grows)
- JPEG output is drawn onto white, so transparent areas do not turn black
- Large reductions resampled in halving steps; photos larger than the device's canvas limit (for example 48 MP on an iPhone) are scaled to fit instead of failing
- JXL and HEIC/HEIF inputs decoded via WebAssembly before compressing
- Accepts files handed over from other tools

## How to use it

1. Drop or pick an image
2. Choose JPEG or WebP
3. Pick a target size (or switch to Quality and drag the slider) and optionally a Max Dimension
4. Compare before/after and click Download Compressed

## Inputs

- JPEG, PNG, WebP, BMP, GIF, AVIF, JXL (.jxl), HEIC/HEIF (.heic, .heif)
- Max 50 MB per file
- One file at a time

## Outputs

- <name>-compressed.jpg or <name>-compressed.webp, named by the format the result really is

## Limits and notes

- Runs on the main thread with the canvas encoder (a target-size search on a 12 MP photo takes about 10 encodes)
- In Quality mode the output can be larger than the original (shown as +%); the original is not offered instead
- Re-encoding from pixels does not carry over the original metadata
- Nothing is stored locally (settings reset on reload)

## Questions and answers

### How does the Image Compressor work?

Your image is decoded (upright, using its EXIF orientation), drawn onto an HTML Canvas (on white for JPEG) and optionally downscaled to a maximum dimension while preserving aspect ratio. In Target size mode (the default) the image is encoded, measured and re-encoded: the tool finds the highest quality whose file fits your limit, and only if even low quality is too big it reduces the pixel size and tells you the final dimensions. In Quality mode it is exported once with the chosen quality (1-100). The browser's native JPEG or WebP encoder does the compression, and a debounced live preview re-compresses on every settings change.

### Can I compress an image to exactly 100 KB or 200 KB?

You can set a maximum: type a size in KB or MB (from 20 KB) or tap 100 KB, 200 KB, 500 KB, 1 MB or 2 MB, and the result is at or under it, usually just under, so it passes an upload form with that limit. If the image already fits as the same format, the original is kept. If the target can't be reached even at 320 px, you get a message with the smallest size it managed and what to try.

### How much can I compress an image?

Typical compression reduces file size by 50-80% with minimal visible quality loss. Photos from cameras are often 3-10 MB and can be compressed to under 500 KB while still looking good on screen.

### Will compression ruin my image quality?

At moderate quality settings (60-80%), compression is nearly invisible to the human eye. The side-by-side comparison lets you see exactly how the compressed version looks before downloading.

## Related tools

- [Color Palette Extractor](https://overtooled.com/color-palette-extractor.md): Extract dominant colors from any image as HEX codes
- [Image Converter](https://overtooled.com/image-converter.md): Convert images to JPG, PNG, WebP, or JPEG XL instantly in your browser
- [Image Cropper](https://overtooled.com/image-cropper.md): Crop, resize, and add background canvas to photos with real-time preview
- [Image Resizer](https://overtooled.com/image-resizer.md): Resize images by pixels or percentage and download the result

---
Overtooled: 179 free tools that run in your browser. Index of all tools: https://overtooled.com/llms.txt
