PNG Optimizer: Lossless & Lossy Compression Guide 2026

By Hieu Dinh

If you work with screenshots, logos, or any graphic that needs transparency, you need a good PNG optimizer. PNG files are famously large — a single 4K screenshot can clock in at 8–12 MB. The good news: a well-chosen PNG optimizer cuts those files by 40–70% with zero visible quality loss, and the best ones do it in seconds, offline, in batch.

This guide walks through how PNG compression actually works, then compares five of the most popular PNG optimizers in 2026 so you can pick the right workflow.

What is a PNG optimizer and how does it work?

A PNG optimizer rewrites a PNG file so it occupies less disk space while keeping the same visible image. Unlike a generic zip utility, it understands the internal structure of the PNG format — chunks, filters, color types, DEFLATE streams — and reorganizes them far more aggressively than general-purpose compression.

PNG optimizers fall into two families:

  • Lossless PNG compression. Output is bit-for-bit identical to the input when decoded. Every pixel and alpha value is preserved. OptiPNG, Oxipng, and Zopfli fall here. Savings typically 5–30%.
  • Lossy PNG compression. The optimizer discards imperceptible color detail, usually by reducing the image to a smart 256-color palette. Pngquant is the canonical example. Savings of 50–80% are common, with full transparency preserved.

Most production-quality PNG optimizers combine both: a lossy quantization pass first, then a lossless entropy-coding pass. Compresto's PNG pipeline uses exactly this two-stage approach, orchestrated with Metal-accelerated color analysis so large batches finish in a fraction of the time of CPU-only tools.

If you only want the short explanation of which setting to use when, our compress PNG without losing quality walkthrough pairs well with this guide.

Why optimize PNG files at all?

Three reasons keep coming up, over and over, in real projects.

1. Web performance. PNG is still the format of choice for logos, UI screenshots, and anything with transparency. Google's Core Web Vitals penalize slow LCP, and LCP is almost always an image. Shrinking hero PNGs from 1.2 MB to 280 KB is one of the highest-leverage SEO moves you can make. For a broader format comparison, see our best image format for websites breakdown.

2. Disk space and repo size. A PNG optimizer pass on a /assets folder can recover 5–10 GB on a typical product team's shared drive, and shrink a git repo by half.

3. Email, Slack, and upload limits. Most platforms cap attachments at 10–25 MB. A PNG optimizer lets you squeeze a 15 MB screenshot under the limit without converting to JPEG and destroying text crispness.

PNG compression techniques explained

PNG was designed in 1996 as a patent-free replacement for GIF, and its compression pipeline has four stages. Understanding each stage explains why different PNG optimizers produce different sizes on the same file.

1. Color type and bit depth

Before a single byte is compressed, a PNG optimizer chooses how pixels are stored. Options include:

  • Truecolor with alpha (RGBA, 32 bits/pixel) — fullest fidelity, biggest file.
  • Truecolor (RGB, 24 bits/pixel) — same color range, no transparency.
  • Grayscale with alpha (16 bits/pixel) — ideal for black-and-white diagrams.
  • Indexed color / palette (1–8 bits/pixel, up to 256 colors) — massively smaller, supports alpha.

Picking the smallest color type that can still represent the image losslessly is free savings. OptiPNG and Oxipng do this automatically.

2. Color palette reduction (quantization)

For lossy PNG compression, the optimizer maps millions of 24-bit colors down to a palette of 256 or fewer. The best widely-used algorithm is the median-cut variant inside pngquant, which also applies Floyd-Steinberg dithering to hide banding. For flat-colored UI screenshots, the difference between 24-bit and well-quantized 8-bit PNG is invisible at 1x — yet three to five times smaller.

3. Filtering

PNG applies one of five per-scanline filters (None, Sub, Up, Average, Paeth) to turn raw pixels into a stream that compresses better. A PNG optimizer tries every filter on every row and picks the winner. This is where most lossless savings come from.

4. DEFLATE (zlib) compression

Finally, the filtered byte stream goes through DEFLATE — the same LZ77 + Huffman algorithm used by zip. Advanced PNG optimizers swap zlib for Zopfli, Google's DEFLATE-compatible encoder that spends 20–100x more CPU to squeeze out the last 3–8% of size.

Compresto is a native macOS PNG optimizer for designers and developers who push a lot of pixels. It wraps the best open-source algorithms (pngquant, Oxipng, Zopfli) behind a native SwiftUI drag-and-drop interface, accelerated with Apple's Metal framework on Apple Silicon.

Why it stands out:

  • Native macOS app — no Electron, no browser, no upload queue. Everything runs locally on your machine.
  • Batch processing — drop a folder of 2,000 PNGs and walk away. Compresto parallelizes across all your CPU cores.
  • Hardware acceleration — VideoToolbox and Metal pipelines mean a 500-image batch finishes in seconds, not minutes.
  • Preserves transparency — full 8-bit alpha channel is kept through both lossless and lossy modes.
  • Drag-and-drop workflow — drop files on the dock icon or the main window; keep originals or overwrite.
  • Privacy by design — nothing ever leaves your Mac. No upload. No server. No tracking.
  • Quality slider — pick between lossless (exact pixels) and quality-aware lossy (default 80, adjustable).

A typical UI screenshot drops from 1.4 MB to 220 KB — an 84% reduction — with no visible difference at 200% zoom. For hero graphics, expect 50–70% savings.

How to use Compresto as a PNG optimizer:

  1. Download Compresto and drag it to /Applications.
  2. Drag one PNG, many PNGs, or a whole folder onto the window.
  3. Pick Lossless or Lossy from the sidebar.
  4. (Optional) Choose "Keep original" or "Replace in place".
  5. Click Compress. Done.

If you're coming from ImageOptim and want a faster, actively maintained alternative with hardware acceleration, see our ImageOptim alternatives comparison.

Method 2: ImageOptim (free, Mac)

ImageOptim is the free, open-source PNG optimizer that shaped the Mac design community for a decade. It chains pngquant, OptiPNG, Zopfli, and AdvPNG in sequence on every file you drop in.

Strengths: zero cost, open source, effective, Mac-native.

Limitations: single-threaded per file, no Metal acceleration, updates have slowed, and the UI hasn't been rethought in years. On 500+ PNG batches it takes minutes where a hardware-accelerated app finishes in seconds. A reasonable free PNG optimizer download for light, occasional use.

Method 3: TinyPNG (online)

TinyPNG is the best-known online PNG optimizer. It uses a proprietary lossy engine and produces 60–80% savings on screenshots.

Strengths: nothing to install, works on any OS, good quality.

Limitations:

  • 20-image free limit per batch, 5 MB file-size cap without a paid account.
  • Requires upload to a third-party server — not acceptable for NDA, medical, or financial assets.
  • Slow for large batches — every file is an HTTP round trip.
  • No offline fallback.

TinyPNG works for one-offs. For a steady workflow, a native PNG optimizer pays for itself quickly.

Method 4: pngquant (command-line)

Pngquant is the C implementation behind most lossy PNG compression on the internet, including TinyPNG. Run it directly from Terminal:

brew install pngquant
pngquant --quality=65-80 --output compressed.png input.png

Key flags:

  • --quality=min-max — acceptable quality range. Below min, pngquant refuses to save (useful for automation).
  • --speed 1 — slowest, best quality. --speed 11 — fastest. Default is 3.
  • --strip — removes EXIF and metadata chunks.

The right tool for repeatable, scriptable lossy PNG compression inside a CI pipeline or asset-build step.

Method 5: CLI batch workflows

For thousands of images, combine pngquant (lossy) and oxipng (lossless) with find:

brew install pngquant oxipng

find ./assets -name "*.png" -print0 | \
  xargs -0 -P 8 -I {} sh -c '
    pngquant --quality=70-90 --skip-if-larger --force --ext .png "{}" && \
    oxipng -o 4 --strip safe "{}"
  '

xargs -P 8 runs 8 parallel workers (tune to your core count). pngquant does lossy quantization at quality 70–90. oxipng -o 4 --strip safe runs a strong lossless pass and removes non-rendering metadata. On a 1,000-file folder, this finishes in under a minute on an M-series Mac — the same thing Compresto does internally, just with more setup.

For similar recipes applied to other formats, see compress JPEG to 1 MB and compress GIF to 1 MB.

How much can you actually compress a PNG?

Real-world numbers from a mixed folder of 1,200 production PNGs:

Content typeAverage inputLossless savingsLossy savings
UI screenshots (macOS, clean backgrounds)1.2 MB22%78%
App icons (1024x1024, transparent)310 KB35%65%
Photography exported as PNG4.8 MB6%45% (often better as JPEG)
Diagrams, charts, flat color480 KB40%85%
Marketing hero images with gradients2.1 MB15%62%

The headline figure: 40–70% reduction with lossy, 15–25% strictly lossless. Photographs compress better as JPEG or WebP — see our JPEG vs PNG and PNG to JPG comparisons. For vector UI, consider an SVG optimizer instead.

Preserving transparency through optimization

Designers always ask: will my transparency survive?

  • Lossless mode: alpha channel preserved exactly. Zero risk.
  • Lossy mode (quantization): the palette includes alpha, so transparency survives, but very subtle alpha gradients can band slightly. Invisible on UI with hard edges; inspect soft drop shadows at 2x before shipping.
  • Converting PNG to JPEG: transparency is lost — JPEG has no alpha channel. Use a PNG to WebP converter instead for smaller files with transparency intact.

Compresto's default quantization preserves typical UI alpha without visible banding. For complex gradient transparency, use the lossless preset.

FAQ

Is a PNG optimizer the same as a PNG compressor? Yes, used interchangeably. "Optimizer" implies a multi-stage tool that adjusts color type, filters, and metadata; "compressor" sometimes means a simpler single-pass tool. In practice, any modern PNG optimizer does all of these jobs.

Is lossless PNG compression really lossless? Yes. Decode the compressed file back to pixels and it matches the original byte-for-byte. That's why lossless savings are smaller (5–30%): there's a hard mathematical ceiling on how much redundancy a given PNG contains.

Can I batch compress PNG files on Mac? Yes. Compresto is built for this — drop a folder and it processes every PNG in parallel using Metal-accelerated color analysis. ImageOptim can do it too, more slowly. On the CLI, the find + pngquant + oxipng pipeline above works great.

What is the best image optimizer for macOS in 2026? Compresto is our pick: native, fast, private, handles PNG, JPEG, WebP, HEIC, and video in one app, fully offline. ImageOptim remains a solid free option for light workloads.

Will PNG compression without losing quality still shrink my files? Yes. Lossless typically saves 15–25% through better filters, Zopfli DEFLATE, and stripping non-visual metadata. For more than that, use lossy PNG compression (usually invisible on UI) or convert to WebP or AVIF.

Should I optimize PNGs before committing them to git? Yes. Once a binary is in git history, it's there forever. Run your PNG optimizer as part of a pre-commit hook or design-export script to save gigabytes of repo size over a project's lifetime.

Wrapping up

A PNG optimizer is one of those tools you install once and quietly save gigabytes of disk, seconds of page load, and hours of "why is this file so big" Slack messages. The right choice depends on your workflow: command-line for CI, ImageOptim for casual Mac use, TinyPNG for the occasional one-off, and a native app like Compresto for anyone who compresses images every day and wants a fast, private, hardware-accelerated experience.

Drop a folder of PNGs into Compresto today — no upload, no account, no quality loss.

Ready to compress your files? Join thousands of creators using Compresto ⚡