---
title: "Compress Images Online — PNG, JPEG & WebP"
description: "Compress PNG, JPEG and WebP images without changing the format. Lossless-first optimization, optional target file size with the aspect ratio locked. Free tier available."
canonical: "https://www.enconvert.com/convert/compress-image"
locale: "en"
endpoint: "compress-image"
---

# Compress Images Online — PNG, JPEG & WebP

Compress PNG, JPEG and WebP images without changing the format. Lossless-first optimization, optional target file size with the aspect ratio locked. Free tier available.

## API

Do this conversion without a browser: `POST https://api.enconvert.com/v1/convert/compress-image` — Compress a PNG, JPEG or WebP image without changing its format — lossless-first optimization (metadata stripped, ICC profile and orientation preserved), with an optional target file size met by aspect-ratio-locked downscaling

- Accepted input: .png,.jpg,.jpeg,.webp

```python
import requests

url = "https://api.enconvert.com/v1/convert/compress-image"
headers = {"X-API-Key": "sk_YOUR_SECRET_KEY"}

with open("input_file", "rb") as f:
    response = requests.post(url, headers=headers, files={"file": f})

with open("output_file", "wb") as f:
    f.write(response.content)
```

Full reference: [EnConvert API documentation](https://www.enconvert.com/docs/introduction.md)

## How to convert

### 1. Upload your image

Drop in a PNG, JPEG or WebP file. The format never changes — PNG stays PNG, JPEG stays JPEG, WebP stays WebP.

### 2. Choose a target size (optional)

Leave the target empty for pure lossless optimization, or set a kilobyte budget and the image is downscaled with its aspect ratio locked until it fits.

### 3. Download the result

You get the smallest file the engine could produce — never larger than your original. Metadata is stripped, while colors and rotation are preserved.

## Why compress images?

Image weight is the single biggest driver of page load time. Shrinking a hero image from 2 MB to 200 KB saves more transfer than most code optimizations combined — and faster pages rank better and convert better.

Lossless-first matters. Most compressors immediately re-encode at a lower quality, degrading every image whether it needed it or not. Enconvert first strips metadata and re-encodes with the strongest lossless settings for the format — PNG and lossless WebP stay pixel-identical, and JPEG keeps its original quantization tables — and only reduces dimensions when you set a hard size budget.

The format never changes. PNG in, PNG out — no surprise conversions that break transparency, and no broken pipelines that expect a specific file extension. Files whose content doesn't match their extension are rejected instead of silently converted.

## Original vs Compressed

| Feature | Original | Compressed |
| --- | --- | --- |
| File size | As uploaded | Never larger — often 20-80% smaller |
| Pixel data | Unchanged | Identical without a target; proportionally downscaled only when a target requires it |
| Metadata | EXIF, XMP and text chunks included | Stripped — ICC color profile and orientation flag kept |
| Format | PNG / JPEG / WebP | Same format — never converted |
| Dimensions | Original | Original, unless a size budget forces an aspect-ratio-locked downscale |

## FAQ

### Does compression reduce my image quality?

Not unless you ask for it. Without a target size, compression is strictly lossless-first: metadata is stripped and the image is re-encoded with the strongest lossless settings for its format — PNG and lossless WebP stay pixel-identical, and JPEG keeps its original quantization tables. Dimensions are only reduced when you set a target file size the lossless stage can't reach.

### How do I compress an image to a specific file size?

Set the target size in kilobytes — for example 200 for 200 KB. Lossless optimization runs first; if the file is still over budget, the image is downscaled with the aspect ratio locked until it fits. If the target is unreachable even at the minimum scale, you get the smallest achievable file instead of an error.

### Will my PNG be converted to JPEG to make it smaller?

Never. The format always stays the same: PNG in, PNG out. Files whose content doesn't match their extension are rejected rather than silently converted, so transparency and downstream pipelines are safe.

### What happens to my photo's metadata?

EXIF, XMP and PNG text chunks are removed, which often saves space by itself and protects your privacy (camera details, GPS location). Two things are deliberately kept: the ICC color profile, so colors don't shift, and the EXIF orientation flag, so rotated photos still display correctly.

### Can I compress animated images?

No. APNG and animated WebP files are rejected with a clear error rather than being silently flattened to a single frame. Static PNG, JPEG and WebP images are fully supported.

## Related conversions

- [Convert PNG to WebP Online - Free, Smaller Files & Same Quality](https://www.enconvert.com/convert/png-to-webp.md)
- [Convert PNG to JPEG Online - Free, Instant & No Sign-Up](https://www.enconvert.com/convert/png-to-jpeg.md)
- [Convert WebP to PNG Online - Free, Lossless & Transparent](https://www.enconvert.com/convert/webp-to-png.md)
