Skip to main content

Image Compression Tool

Compresses JPEG, PNG, WebP, and PDF files to a chosen target size by binary-searching encoder quality in the browser, with no server upload. Targets run from 10 KB to 1 MB or a custom byte limit. PDF pages are rasterized to JPEG and reassembled, so selectable text, fonts, and vector artwork are not preserved.

Your inputs stay in your browser

Everything you enter is processed on your device. This tool loads a code library from cdnjs.cloudflare.com, which sees your IP address but never what you type.

Web Performance
File Optimization
Photography
Loading the tool
Reference

Documentation

An image compression tool reduces a JPEG, PNG, WebP, GIF, BMP, or PDF file to a chosen target size, entirely inside the browser, with no upload to a server. The file loads onto an HTML Canvas element, and a binary search over the output quality parameter converges on the byte count specified as the target.

JPEG and WebP expose a quality dial from 1 to 100, so the search narrows that dial in progressively smaller steps until the exported file lands at or below the target. PNG is lossless and has no quality parameter, so reaching a smaller PNG target instead requires scaling down the pixel dimensions. WebP often reaches a smaller size than JPEG at comparable visual quality; PNG preserves lossless detail but limits how far size can drop without scaling; PDF input is rebuilt from compressed page images rather than encoded directly.

Target size presets run from 10 KB up through 1 MB (10, 20, 30, 50, 100, 150, 200, 300, 500 KB, or 1 MB), or any custom byte value. For a PDF, the render scale set before loading the file governs the raster resolution each page is drawn at, which caps how much detail can survive compression: 2x produces sharper pages at a larger starting size, 1x produces the smallest starting point.

The result reports the final file size, the percentage reduction from the original, the quality level the search settled on, and the number of iterations it took. Settings holds a maximum-iterations limit (higher values improve precision at the cost of speed), a minimum quality threshold that keeps the search from dropping below an acceptable floor, a toggle to allow scaling the image down when quality reduction alone cannot reach the target, and an option to download the result automatically once compression finishes.

Each iteration tests one quality value and compares the resulting file size against the target, narrowing the range until it converges. If the search exhausts the maximum iteration count or hits the minimum quality floor before the file drops under the target, the reported size is the closest the format could reach rather than an exact hit, most often a PNG target set well below what scaling the pixel dimensions down can achieve, or a JPEG target too small for the image's detail even at the lowest allowed quality.

PDF support works by rendering each page to a canvas, compressing that raster to JPEG, and assembling the results into a new document. The consequence is that a compressed PDF is a picture of the original, not a copy of it. Selectable and searchable text, embedded fonts, hyperlinks, bookmarks, form fields, annotations, and vector artwork are all discarded. Page dimensions and visual order are preserved.

This trade is worth making for scanned documents, image-heavy brochures, exported slide decks, and any PDF that is already a collection of photographs, because those files carry no text layer to lose and their bulk lives in the images. It is the wrong trade for contracts, reports, invoices, and academic papers, where losing the text layer breaks search, accessibility, screen reader output, and copy and paste. For those documents, a tool that recompresses embedded image streams while leaving the text layer intact is the better choice. This limitation is stated before a PDF is compressed and repeated with every result, and the target size applies to the whole assembled document rather than to each page individually.

  • Preserved: page count, page order, page dimensions, and visual appearance at the rendered resolution.
  • Discarded: text layer, fonts, links, bookmarks, form fields, annotations, and vector paths.
  • Target behavior: the size limit applies to the finished document, and every page shares one quality setting so compression stays visually even.

Controlling file size is a recurring need across web publishing, email communication, application development, and document preparation. The presets in this tool map directly to common upload limits and performance budgets encountered in everyday workflows.

  • Web performance: Reduce hero images and thumbnails to 50 KB or 100 KB to meet Core Web Vitals thresholds and cut page load time on mobile connections.
  • Email attachments: Shrink product photos or event images to 200 KB or 300 KB so they fit within attachment size limits and render quickly in mail clients.
  • Social media uploads: Prepare profile pictures and cover photos at 150 KB or below to avoid platform re-compression artifacts that degrade visual quality.
  • E-commerce listings: Batch-prepare catalog images at 100 KB each to keep product pages responsive while retaining enough detail for zoom features.
  • Documentation and wikis: Compress screenshots to 30 KB or 50 KB before embedding them in internal knowledge bases, reducing repository bloat and page render time.
  • Mobile app assets: Target 10 KB or 20 KB for icons, badges, and placeholder images bundled inside app binaries where every kilobyte affects download size.
  • Form submissions: Meet upload-field limits (often 500 KB or 1 MB) on government portals, insurance claims, or university applications that reject oversized files.
  • Print pre-flight: Convert large camera RAW exports to WebP at 500 KB for quick client review rounds before sending full-resolution files to the printer.
  • Archival storage: Reduce personal photo collections to 200 KB per image when long-term cloud storage costs matter more than pixel-perfect fidelity.
Inputs, outputs, and what the Image Compression Tool computes

What the Image Compression Tool asks for and what it returns, as a plain list. Defaults, units, and ranges are the ones the form loads with.

Inputs

  • Target File Size · default: 100 KB
  • Custom target size (KB) (numeric input) · default: 100 · range: 1 to 10240
  • Output Format · default: JPEG
  • PDF render scale · default: 1.5x
  • Max compression iterations (numeric input) · default: 20 · range: 1 to 50
  • Automatically download after compression · default: off
  • Preserve original dimensions (reduce quality only) · default: on
  • Minimum quality threshold (1-100) (numeric input) · default: 1 · range: 1 to 100

Controls

Reset