Skip to main content

Image Compression Toolv1.0.0

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

Reduce any image to a precise file size entirely within your browser. No data leaves your device during the compression process. The tool loads the selected image onto an HTML Canvas element, then performs a binary search over the output quality parameter to converge on the byte count you specify. JPEG and WebP formats accept a quality dial between 1 and 100, so the algorithm adjusts that dial in progressively smaller steps until the exported blob lands at or below your target. PNG is a lossless format with no quality parameter, so reaching a smaller PNG target may require scaling down the pixel dimensions.

  • Click Select an image or PDF file and choose a JPEG, PNG, WebP, GIF, BMP, or PDF file from your device.
  • Review the Original File Info panel, which displays the file name and original byte size. Images also report pixel dimensions; PDFs report the page count and the resolution each page was rendered at.
  • Open the Target File Size dropdown and pick a preset (10 KB, 20 KB, 30 KB, 50 KB, 100 KB, 150 KB, 200 KB, 300 KB, 500 KB, or 1 MB). Select Custom to type any kilobyte value into the Custom target size (KB) field that appears.
  • Choose an Output Format. JPEG works well for photographs. WebP often achieves smaller sizes at comparable visual quality. PNG preserves lossless detail but limits how far size can drop without scaling. PDF applies to PDF input and rebuilds the document from compressed page images.
  • For a PDF, set the PDF render scale before loading the file. 2x produces sharper pages at a larger starting size, 1x produces the smallest. The scale governs the raster resolution each page is drawn at, which caps how much detail survives compression.
  • Press Compress to start the optimization loop. A spinner appears while the tool iterates through quality levels. The Compression Result panel then shows the final file size, the percentage reduction from the original, the quality level used, and the number of iterations performed.
  • Click the Download Compressed Image link to save the result. Enable Automatically download after compression in the settings panel to skip this step on future runs.
  • Adjust Max compression iterations if you want the binary search to run more or fewer cycles. Higher values improve precision but take longer.
  • Open the settings panel by clicking Settings below the main buttons. Toggle Preserve original dimensions off if you want the tool to scale the image down when quality reduction alone cannot reach the target. Set a Minimum quality threshold to prevent the algorithm from dropping below a floor you find acceptable.
  • Press Reset at any time to clear the loaded file, restore all fields to their defaults, and remove saved preferences from local storage.

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. The tool states this limitation in the upload panel, repeats it in the results panel after every PDF run, and applies the whole target size to the 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

The form above accepts the following inputs and produces the outputs listed below. This summary is rendered in the page so the parameters are visible to crawlers, assistive tech, and indexing agents that don't fetch the embedded tool frame.

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: 1
  • Preserve original dimensions (reduce quality only) · default: 1
  • Minimum quality threshold (1-100) (numeric input) · default: 1 · range: 1 to 100

Controls

Reset

Worked example

For a PDF, set the PDF render scale before loading the file. 2x produces sharper pages at a larger starting size, 1x produces the smallest.