Compress Image

Reduce one JPG, PNG, or WebP image using either a quality setting or a maximum target size. Quality mode keeps the original dimensions; target-size mode searches for a JPEG quality and may reduce dimensions when the requested byte limit cannot otherwise be reached.

Browser-first workflowProcessing details below

What the two compression modes do

Quality mode redraws the source at its original dimensions. JPEG and WebP inputs are exported as JPEG using the selected quality. PNG input is exported as PNG, although browsers may ignore the quality argument for PNG because its canvas encoding is lossless.

Target-size mode always produces JPEG. It tries several JPEG quality values and, when necessary, progressively reduces width and height. A white background is drawn first, so transparent areas become white.

How to use this tool

  1. Select an image: Choose a JPEG, PNG, or WebP file and review its reported source size.
  2. Choose a mode: Use By quality for direct encoder control, or Target size when a form imposes a maximum byte size.
  3. Set the control: Adjust the quality slider, or enter the desired KB/MB ceiling. Extremely small targets may require dimension reduction.
  4. Compress and compare: Run the operation, compare the reported sizes, visually inspect the downloaded image, and keep the original.

Input and output

Input

  • One browser-decodable JPEG, PNG, or WebP image
  • A quality from 10% to 95%, or a positive target in KB or MB

Output

  • JPEG for target-size mode
  • PNG for PNG quality-mode input; JPEG for JPEG or WebP quality-mode input

How quality and target-size modes differ

Quality mode

The browser redraws the image at its original pixel dimensions and calls the canvas encoder with the chosen quality. The effect of that parameter depends on the output format and browser.

Target-size search

The tool performs a bounded binary search across JPEG quality values. If none fit, it makes up to seven dimension-reduction attempts and searches again.

No exact-size promise

The result aims to be at or below the target. Encoder behavior and image complexity mean it is not padded to an exact byte count.

Preparing an image for a size-limited form

Scenario
A form accepts images no larger than 150 KB.
Action
Choose Target size, enter 150 KB, compress, and inspect the result.
Input
A single JPEG above the form limit
Expected result
The tool attempts to create a JPEG no larger than 150 KB. It may lower quality or dimensions; no specific reduction percentage is guaranteed.

Compression, format and metadata limitations

  • There is no explicit upload-size limit; decoding and repeated canvas exports consume browser memory.
  • A compressed result can occasionally be similar in size or larger than an already optimized source.
  • Target-size mode converts every supported source to JPEG and replaces transparency with white.
  • WebP quality-mode input is exported as JPEG, not WebP.
  • PNG quality mode may not shrink significantly because canvas PNG encoding does not use lossy quality control in the same way as JPEG.
  • Canvas export does not reliably retain EXIF, GPS, colour profiles, animation, or other source metadata.
  • Very small targets can fail after the bounded search and resize attempts.

Frequently Asked Questions

Why did my PNG not get much smaller in quality mode?

The implementation keeps PNG as PNG in that mode. Browser canvas PNG encoding is lossless and generally does not respond to the quality value like JPEG encoding does.

Why did transparency disappear?

Target-size mode draws a white background and exports JPEG, which has no alpha transparency channel.

Will the result be exactly the requested size?

No. Target mode aims for a result at or below the limit and returns the best candidate it finds without padding to an exact size.