Skip to main content

Image optimizer

Optimize a JPEG, PNG or WebP image locally: choose the format, the quality or a target size, and compare the estimated size with the original.

  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Image
No image loaded

Drop an image here

Add a PNG, JPEG, or WebP image. The file stays on your device and all edits run locally in your browser.

Need more editing options?

Use multiple editing tools in one workspace, with your open file and its current edits.

Open the full editor

Was this tool useful?

On this page

How does this tool work?

A camera photo often weighs several megabytes, far more than a web page, an email or a size-limited form needs. This optimizer re-encodes the image at the quality you choose or aims straight for a size in kilobytes, and shows the resulting size before you download, without uploading the photo.

Choose the Output format: Keep current format, PNG, JPEG, WebP, AVIF, BMP or GIF. For JPEG, WebP and AVIF, the Quality slider runs from 20 to 100% (82% by default); for PNG, BMP and GIF, which have no quality setting, a note says so. The Estimated size comes from actually encoding the image, with the change in percent compared with the original file.

The Target size (KB) field first shows the current size. Enter a lower value: the tool looks for the quality that comes closest in seven attempts, by halving the 20–100% range, then sets the slider and shows the size actually reached. The target only applies to JPEG, WebP and AVIF.

Dimensions do not change; to reduce the resolution, use the resizer first. AVIF, BMP and GIF use an FFmpeg module downloaded on first use. The file is saved with -edited added to its name.

How to use this tool

  1. Import the image

    Drop a PNG, JPEG or WebP photo or screenshot.

  2. Set format and quality

    Choose WebP or JPEG for a photo, then adjust the quality or enter a target size.

  3. Check and download

    Compare the estimated size with the original file, look at the preview, then download.

Finding the quality for a target size

Quality is found by binary search: each attempt halves the remaining range, enough to cover 81 values in seven attempts.

Quality tried

q_k = round((b_min + b_max) ÷ 2)

If the size exceeds the target, b_max = q_k − 1; otherwise b_min = q_k + 1.

Change shown

Δ = S_estimated ÷ S_source − 1

Negative when the optimised file is lighter.

b_min, b_max
quality bounds, 20 to 100 at the start
q_k
quality tried at step k
S
size of the estimated file and of the original file

Use cases

Speed up a web page

Lighten the photos of an article or a shop so they load faster on mobile.

Meet an upload limit

Bring a photo under the 500 KB required by an application form or an administration.

Save space

Reduce the size of screenshots and photos before archiving them or emailing them.

Examples

Searching for a target size

First attempt at round((20 + 100) ÷ 2) = 60%. If the file is too heavy, the upper bound becomes 59 and the next attempt is round((20 + 59) ÷ 2) = 40%; otherwise the search goes up. After seven attempts, the quality closest to 300 KB is kept.

Input

JPEG photo, WebP format, target size 300 KB

Result

Quality adjusted automatically, then the size actually reached shown in the field

PNG screenshot

PNG has no quality setting: to make it much lighter, switch to WebP, which keeps transparency and compresses large flat areas far better.

Input

1,920 × 1,080 px PNG screenshot, format kept

Result

Quality disabled, "lossless format" note

Tips and best practices

  • For a web photo, a quality between 70 and 85% is rarely distinguishable from the original on screen.
  • Reduce the dimensions first: a 6,000 px photo shown at 1,200 px is needlessly heavy, whatever the quality.
  • Compare with Before / after, zooming into fine detail (text, hair, foliage), before settling on a low quality.
  • The target size is approximate: depending on the image content, the result may be slightly above or below.

Sources and references

Frequently asked questions

What is the difference between quality and target size?

Quality sets the compression level directly. Target size works the other way round: you give a size and the tool finds the quality that comes closest.

Why does quality not apply to PNG?

PNG is a lossless format: it keeps every pixel. To reduce its size significantly, convert it to WebP or JPEG.

Is the target size guaranteed?

No. The search tests seven qualities and keeps the closest; a very detailed image may stay above it even at 20%.

Do the image dimensions change?

No. The optimizer only changes compression; use the resizer to reduce width and height.

Is metadata kept?

A re-encoded image loses its EXIF metadata, including the GPS position. Use the metadata reader to check.

Is my image uploaded to a server?

No. Every estimate and the final export are encoded in your browser.

Related tools

Tools similar or complementary to this one.

Works well with

Convert an image to PNG, JPEG, or WebP and adjust output quality before download.

Images & graphicsFeaturedUse this tool

Resize an image by setting its exact width and height before downloading the result.

Images & graphicsFeaturedUse this tool

See a photo’s EXIF and GPS data, then download a copy that no longer contains it.

Images & graphicsUse this tool
TutorialBest practicesBeginner

Optimize images for the Web without losing quality

Resize, compress and choose between WebP, AVIF and other formats with a practical workflow that reduces file size without unnecessary visual loss.

30 August 20264 min