CruxDevCruxDev Tools Prompts
image Utility • Zero-Server Privacy • 100% Client-Side

Image Compressor

Shrink JPEG and WebP file sizes with a quality slider and optional max-width. Preview the result and see exactly how many percent you saved.

Overview

Shrink photos and screenshots in your browser with real control over the result: pick JPEG, WebP, AVIF or PNG, drive a quality slider, or type a target file size and let the tool binary-search the encoder until the output fits. Whole batches of up to 20 images compress in one pass with per-file results and a single ZIP download, and every output file is verified by its actual bytes before you can download it. Nothing is uploaded, which makes it practical for private or client images.

How It Works

Drop one image or up to twenty onto the upload area - JPEG, PNG, WebP, GIF, AVIF and BMP inputs up to 25 MB are accepted. The controls cover four output formats whose availability is probed live in your browser, a size mode toggle between a plain quality slider and target-file-size mode (type a KB figure and the tool re-encodes up to eight times, hunting for the highest quality that fits), a max-width slider where 0 keeps the original size, a metadata choice of Strip (default) or Keep EXIF, and a transparency fill colour that appears for JPEG output. Results appear per file with input bytes, output bytes, the percentage changed, the quality actually used and the output dimensions; a ZIP button bundles the whole batch. In quality mode the batch recompresses automatically about a quarter second after any control changes.

Step-by-Step Usage Guide

  1. Drop one image or a batch of up to twenty onto the upload area.
  2. Pick the output format - availability is probed and shown honestly.
  3. Choose quality mode and a slider value, or target mode and a KB figure.
  4. Set max width, metadata handling and a JPEG fill colour if relevant.
  5. Read the per-file results and download individually or as one ZIP.

Technical Specifications & Standards

Three engineering decisions separate this from a bare canvas.toBlob wrapper. First, honesty about format support: before every download the output bytes are sniffed by magic numbers - JPEG must start FFD8, PNG must carry its eight-byte signature, WebP must be a RIFF/WEBP container, AVIF must be an ISOBMFF box with the avif or avis brand. Browsers that lack an encoder silently fall back to PNG instead of failing, so on such a browser the AVIF option is disabled in the UI or refused at download time rather than producing a file that is not really AVIF. Second, metadata is explicit. The default strips everything: the output is a fresh encoder product, so EXIF including GPS coordinates is simply gone, and photos stored with a rotation flag are decoded upright, which is why re-encoded photos come out the right way round here when many simple tools hand them back sideways. Keep EXIF (JPEG output only) copies the original APP1 segment into the re-encoded file and resets its orientation flag to 1 - the pixels are already upright, and leaving the old flag would make metadata-aware viewers rotate the image a second time; the browser encoders for WebP, AVIF and PNG cannot embed EXIF at all, so the option is honestly JPEG-only. Third, scale and memory: large sources decode through createImageBitmap off the main thread where available, downscaling happens in repeated halvings for clean results, and any source above the 60-megapixel working limit is downscaled to fit rather than crashing the tab. Converting a transparent PNG to JPEG composites onto your chosen background colour instead of letting transparency collapse to black.

Targeted Use Cases

  • Getting product photos under a marketplace upload limit with a hard KB ceiling.
  • Batch-compressing a folder of screenshots for a web page and grabbing the ZIP.
  • Producing AVIF for a modern site chain, with a guaranteed-honest fallback where the browser cannot.
  • Publishing camera photos with the GPS coordinates demonstrably gone.

Notes & Gotchas

  • Use target mode when a size limit is hard (email, form uploads, CMS caps); use the slider when visual quality is the constraint.
  • Photos generally shine as WebP or AVIF near quality 70-80; JPEG remains the safest universal target.
  • Keep EXIF only if you need the camera data in the output - and remember it survives only in JPEG.
  • Set a max width for web images; a 4000-pixel camera original is rarely useful at full size on a page.

Frequently Asked Questions

Are my images uploaded to a server?

No. Decoding, resizing, quality search and re-encoding all happen in your browser. The file never leaves your device.

How does target-file-size mode work?

It binary-searches the encoder: encode, measure real bytes, halve the quality range, repeat up to eight times, then report the highest quality whose output fitted. If even minimum quality cannot reach the target it says so and hands you the smallest file the encoder makes.

What if my browser cannot encode AVIF?

Support is verified by inspecting the encoders actual output bytes, not by trusting the API. Without a real AVIF encoder the option is disabled, and nothing is ever saved with an .avif name that is secretly a PNG or WebP.

Does compression remove EXIF data like GPS?

By default yes - the output is a fresh re-encode with no metadata. Keep EXIF re-inserts the original camera data into JPEG output, minus the rotation flag, which is reset because the pixels are baked upright.

Why do my re-encoded photos come out the right way round?

The rotation flag in EXIF is applied at decode time, so the output pixels are upright. Tools that skip this step produce sideways photos from the same input.

What is the file size limit?

Inputs up to 25 MB each, twenty files per batch, and a 60-megapixel working ceiling per image; larger sources are downscaled to fit instead of exhausting canvas memory.

Can I compress PNG without quality loss?

PNG output is offered and is lossless, but its encoder has no quality knob, so the target-size search is disabled for it - target mode applies to JPEG, WebP and AVIF.