Files & Images Runs locally Ready to use Built-in examples No tracking

Image Compressor

Compress images locally: convert to JPG, PNG or WebP, control size by quality and longest side, compare before/after file sizes and download in one click. Fully local processing.

An attachment over the size limit, a blog image that drags the page down, a photo library running out of room — shrinking images is the most common tidy-up there is. Pick a format, set the quality, cap the longest side, and two controls manage the weight; the before-and-after sizes are visible straight away, and when a PNG will not budge it can be converted to JPG.

On the settings: the quality factor applies only to lossy formats such as JPG and WebP — 80 is the usual default, 60 suits images shared in chat and 85 or above is for archiving or printing. PNG is lossless, so re-encoding it changes little; converting to JPG or WebP is what loses real weight. The longest-side resize stacks with compression, and leaving it at 0 compresses without rescaling.

How to use

  1. Choose the source image, or start from the demo image.
  2. Pick an output format — WebP is usually the smallest.
  3. Set the quality and, if needed, the longest side; 0 means no resizing.
  4. Compare the before and after sizes, then download the result.

How it works

Pick and compress

Press "choose image" to pick a photo or screenshot, or switch to the built-in demo to preview; adjust quality and longest side, press compress, and the before/after sizes appear below — download to save.

How quality works

Quality applies only to JPG and WebP: 80 is the common default with visually indistinguishable loss; around 60 suits chat groups and web pages; keep 85+ for printing or archiving. Lower means smaller but more blocky artifacts.

Resizing by longest side

Longest side scales the image proportionally to stay within the given pixels — right for avatars and ID photos where original resolution doesn't matter. 0 means no resize, format compression only.

Choosing the output format

Keep transparency with PNG; want dramatically smaller files, choose JPG or WebP — WebP usually beats JPG by another 20-30% at equal quality, ideal for web and chat; for editing later in other software, JPG's compatibility is safer.

Code example

JavaScript Canvas compression with a longest-edge cap

// read file -> draw to canvas -> scale by longest edge -> export with toBlob
async function compress(file, maxEdge = 1920, quality = 0.8) {
  const img = await createImageBitmap(file);
  const scale = Math.min(1, maxEdge / Math.max(img.width, img.height));
  const canvas = document.createElement('canvas');
  canvas.width = Math.round(img.width * scale);
  canvas.height = Math.round(img.height * scale);
  canvas.getContext('2d').drawImage(img, 0, 0, canvas.width, canvas.height);
  // PNG is lossless, so quality is ignored; export JPG or WebP to cut size
  return new Promise((resolve) => canvas.toBlob(resolve, 'image/jpeg', quality));
}
const small = await compress(fileInput.files[0], 1600, 0.75);

Python Compress to a longest edge with Pillow

from PIL import Image

def compress(src, dst, max_edge=1920, quality=80):
    img = Image.open(src)
    img.thumbnail((max_edge, max_edge))        # equal-ratio shrink only, never enlarges
    img.convert('RGB').save(dst, 'JPEG', quality=quality, optimize=True)

compress('photo.jpg', 'small.jpg', 1600, 75)

FAQ

Are images uploaded to a server?

No. Compression uses the browser's built-in canvas — choose, compress and download all happen on your device, and losing connection mid-way doesn't affect the open page. That's the fundamental difference from upload-based compression sites.

Why did my PNG barely shrink?

PNG is lossless — re-encoding only trims a little metadata. To shrink meaningfully, switch output to JPG or WebP: lossy compression discards redundant data by quality factor and often reaches a fraction of the size.

Does compression damage image quality?

Moving to lossy formats like JPG/WebP discards some data, though around quality 80 it's usually imperceptible. Keep a backup of important photos and check the preview before exporting.

How large an image can it compress?

Keep each image within 30 MB. Bigger ones may fail on device memory limits — crop or downscale with system tools first; on phones, avoid running too many apps simultaneously.

WebP or JPG?

It's size versus compatibility: WebP is smaller at equal quality — good for web, chat and storage; JPG is more universally accepted — better for importing into other editors. Neither supports transparency.

Why isn't the output size exactly what I set?

Scaling computes proportionally then rounds, guaranteeing at least 1 pixel in width and height, so results can differ from input by up to 1 pixel. The result area's numbers are authoritative.

Is batch compression supported?

The current version handles one image at a time — swap in the next and keep going. Batch queues and zipped downloads are planned; heavy batch users are welcome to send feedback.