Best PNG Compression Techniques (2026)

PNG files leave your design tool looking fine. They arrive in your browser weighing three times what they should. The gap between those two moments — the export and the delivery — is where most teams lose page speed, Core Web Vitals points, and conversion rate, often without knowing why. The problem isn't that PNG compression is hard. It's that the wrong techniques get applied, or the right ones get applied in the wrong order. A logo compressed with photo settings. A photograph stored as PNG when it should never have been. Metadata from a camera's GPS sensor silently riding along with every hero image.

This guide covers every technique that actually works — ranked, explained, and ready to apply today.

⚡ Quick Answer

The best PNG compression technique for most web images is a two-pass approach: run pngquant first (lossy palette quantization at quality 85–100) to cut colors, then pass the result through OxiPNG (lossless DEFLATE recompression) to squeeze the compressed stream further. Always strip metadata first. This combination typically achieves 60–80% file size reduction with no visible quality loss.

1. What is PNG compression?

PNG compression is the process of reducing a PNG file's size by encoding its pixel data more efficiently. Every PNG file is built from chunks — self-contained data blocks that include image pixels, metadata, and color profiles. The pixel data inside a PNG is compressed using DEFLATE, the same algorithm used in ZIP files, applied to a pre-processed, filtered version of the pixel stream.

There are two fundamentally different approaches, and mixing them up is where most people go wrong:

Understanding this split explains why some techniques save 8% and others save 75%. Lossless recompression is a tune-up. Lossy quantization is a rebuild. Both have their place — and the best results come from applying both, in the right order, to the right images.

📌 Inside a PNG File The chunks that matter most for compression: IDAT (the compressed pixel data — where DEFLATE runs), PLTE (the color palette for indexed images), tEXt/iTXt/iCCP (metadata — strip these entirely for web use), and IHDR (image header — color type here determines bytes-per-pixel before compression even starts).

2. Why PNG compression matters for your site

Images are the single largest contributor to page weight on most websites. PNG is the format most commonly misused — chosen out of habit for photographs, exported at maximum quality, and served with metadata intact. The downstream effect is real and measurable.

80% Typical savings with lossy quantization on flat graphics
25% Average savings with lossless recompression alone
How much larger unoptimized PNGs can be vs equivalent WebP
30KB Metadata alone that can be hidden in a single PNG from a phone camera

Google's Largest Contentful Paint (LCP) — the Core Web Vitals metric directly tied to perceived load speed and search ranking — is most frequently caused by an unoptimized above-the-fold image. A 1.2 MB hero PNG that should be a 90 KB WebP is not an edge case; it's one of the most common audit findings on real production sites.

Compressing PNG files correctly is one of the highest-ROI optimizations available because it requires no code changes, no infrastructure work, and no trade-off in visual quality when done well.

3. Step-by-step PNG compression guide

Follow these steps in order. Each one builds on the previous. Skipping to step 4 without doing step 1 is one of the most common reasons compression results are disappointing.

1
Decide if PNG is the right format

Before compressing anything, ask: should this even be a PNG? Photographs belong in JPEG or WebP. Logos and icons with geometric shapes belong in SVG. Only images that need lossless preservation and transparency should stay as PNG. Changing format is almost always more effective than compressing harder within the wrong one.

2
Resize to the actual display dimensions

Compression cannot fix a 2000×2000 image served in a 400×400 container. Resize first, then compress. For retina displays, serve a 2× version (800×800) via HTML srcset — not a 5× oversized original. Resizing to display dimensions alone routinely produces 80–95% file size reductions that no compression algorithm can match.

3
Strip all metadata

Remove tEXt, iTXt, iCCP, gAMA, cHRM, bKGD, pHYs, and sBIT chunks. These are invisible to browsers but can add 5–30 KB per file. Phone photos carry GPS coordinates; design tool exports carry Adobe XMP blocks and color profiles. Stripping them is always safe for web use and is also a user privacy requirement for platforms that accept image uploads.

4
Reduce the color type if possible

Design tools default to RGBA (4 bytes per pixel). If your image has no transparent pixels, convert to RGB (3 bytes). If it uses fewer than 256 distinct colors, convert to indexed/palette mode (1 byte per pixel). This single step — changing from RGBA to indexed — reduces the raw data entering the compressor by 75%, producing dramatically better DEFLATE results downstream.

5
Run lossy palette quantization (for non-critical images)

Use pngquant at quality 85–100 to map the image to a 256-color palette. This is where the largest savings come from — typically 50–70% reduction. Enable Floyd-Steinberg dithering for images with gradients; disable it for flat graphics with large solid areas (dithering adds noise that DEFLATE cannot compress). Always inspect the output at 100% zoom before shipping.

6
Run lossless DEFLATE recompression

Pass the quantized output through OxiPNG or a Zopfli-based compressor. This re-runs the DEFLATE stage at maximum effort — testing all five PNG filter types per row, exploring more LZ77 back-reference paths, and stripping any remaining metadata. Adds another 5–15% on top of the quantization savings with zero additional quality cost.

7
Verify the output visually and check the size budget

Compare the output against the original at 100% zoom — check gradients, text, edges, and skin tones. Then verify the file size meets your budget: hero images should be under 100–150 KB, UI icons under 8 KB, product thumbnails under 40 KB. If a file still exceeds budget after compression, the answer is usually a format switch (to WebP) rather than more aggressive compression.

⚙️ The Two-Pass Command Line Workflow For production pipelines, run both tools in sequence. pngquant first, OxiPNG second — never the reverse, since quantization changes the pixel data that OxiPNG's filter optimization is calibrated against.
Command Line · Two-Pass Optimization
# Pass 1: Lossy quantization (quality 85–100, maximum effort) pngquant --quality=85-100 --speed=1 --output=step1.png input.png # Pass 2: Lossless recompression + strip all metadata oxipng --opt max --strip all --out output.png step1.png

For lossless-only workflows (screenshots, text-heavy images)

Command Line · Lossless Only
# Lossless recompression with metadata strip — no pixel changes oxipng --opt max --strip all --out output.png input.png # With Zopfli for ~3–8% additional savings (slower) oxipng --opt max --strip all --zopfli --out output.png input.png

Serving the compressed file correctly

Compression is wasted if the file isn't served correctly. Set these attributes on every image tag to prevent layout shift and ensure the browser picks the right size for the display:

HTML · Responsive Compressed Image
<img src="hero-400.png" srcset="hero-400.png 400w, hero-800.png 800w" sizes="(max-width: 600px) 400px, 800px" alt="Descriptive alt text" width="800" height="450" loading="lazy" >

4. Common PNG compression mistakes

These aren't rare edge cases. They appear across thousands of production sites and each one represents recoverable file size that's actively slowing your pages down.

Using PNG for photographs

Photographs have millions of colors and continuous gradients — exactly what PNG's lossless approach handles worst. A 500 KB JPEG and a 2.5 MB PNG of the same photo look identical on screen. If you're storing photos as PNGs, switch formats. No amount of PNG compression will close that gap.

Exporting RGBA when there's no transparency

Every design tool defaults to RGBA exports. If the image has no transparent pixels, that alpha channel stores 255 (fully opaque) for every pixel — 25% extra data that encodes nothing. A good optimizer catches this, but checking color type at export time is faster and more reliable.

Never stripping metadata

An iPhone photo embedded in a PNG can carry 10–30 KB of EXIF data: GPS coordinates, camera model, shutter speed. Design tool exports carry Adobe XMP blocks and full ICC color profiles. None of this affects browser rendering. Stripping it is always safe — and for platforms hosting user-uploaded images, it's a user privacy requirement.

Compressing the wrong-sized image

Compressing a 2000×2000 PNG perfectly and displaying it in a 200×200 container is not optimization. The browser downloads 100× more pixel data than it renders. Resize to display dimensions first, then compress. This step alone often outperforms every compression technique combined.

Applying uniform settings to every image

A flat logo with 8 colors and a gradient-heavy illustration respond completely differently to quantization settings. Flat graphics need indexed mode with no dithering. Complex images need higher color counts with Floyd-Steinberg dithering. A single preset applied to all images produces suboptimal results across the board.

Not verifying output visually

A file size number is not a quality check. Lossy quantization at aggressive settings can produce visible banding in gradients, color shifts on skin tones, and edge artifacts on anti-aliased text. Check the output at 100% zoom — especially on smooth gradients, fine typography, and images with precise brand colors.

Compressing once and forgetting

Image assets change. New team members upload unoptimized PNGs. A CMS accepts uploads without processing. A design tool update changes export defaults. A one-time optimization erodes under real production conditions. Automated compression in your build pipeline or upload pipeline is the only approach that holds.

5. Real-world examples

These examples show what each technique achieves on the image types it's actually suited for. The numbers are representative of typical results — your specific images will vary based on content complexity and color distribution.

Example 1 · Flat Logo
App icon exported as RGBA PNG

Original: 48 KB RGBA export from Figma, 512×512, 12 distinct colors. After converting to indexed mode (1 byte/pixel) + OxiPNG lossless recompression: 6.2 KB. No visual change detectable at any zoom level.

↓ 87% reduction · Zero quality loss
Example 2 · UI Component
Feature section illustration with gradients

Original: 210 KB RGBA PNG, complex gradient background, semi-transparent elements. After pngquant at quality 90 + OxiPNG: 52 KB. Gradient banding imperceptible at 100% zoom with Floyd-Steinberg dithering enabled.

↓ 75% reduction · Visually lossless
Example 3 · Screenshot
UI screenshot with text and fine detail

Original: 890 KB full-page screenshot with pixel-precise text rendering. Lossless only: OxiPNG strips metadata and recompresses → 640 KB. Lossy quantization avoided — text anti-aliasing requires precise color values that quantization degrades visibly.

↓ 28% reduction · Full lossless fidelity
Example 4 · Product Photo
Product image stored as PNG "for quality"

Original: 3.2 MB RGBA PNG, no transparency used. Correct fix: convert to WebP lossy at quality 85 → 180 KB. A PNG compressor would have produced ~2.6 MB at best. Format choice, not compression level, is the lever here.

↓ 94% reduction · WebP conversion

6. PNG compression technique comparison

Use this table to match technique to image type. The right combination depends on content, use case, and whether the image is a candidate for format conversion.

Technique Best For Typical Savings Quality Impact Tools
Metadata stripping All PNGs — always run first 5–30 KB / file None OxiPNG, ImageOptim
Color type reduction (RGBA → RGB or indexed) Logos, icons, flat graphics 25–75% None OxiPNG, pngquant
Lossless DEFLATE recompression Screenshots, text, master files 5–25% None OxiPNG, Zopfli
Lossy palette quantization UI graphics, illustrations, icons 50–80% Imperceptible at q80+ pngquant, Rebrixe
Two-pass (quantize + recompress) Most web images requiring transparency 60–80% Imperceptible at q85+ pngquant + OxiPNG
Convert to WebP Any image where PNG isn't required 25–80% over optimized PNG None (lossless) / Imperceptible (lossy) cwebp, Rebrixe, Sharp
Convert to JPEG Photographs without transparency 70–90% over equivalent PNG Minimal at q82–88 Any image tool
Convert to SVG Logos, icons, geometric vector art 70–95% (size + infinite scaling) Better — vector is sharper Illustrator, Inkscape, SVGO
📏 The Format Decision Gate Before applying any compression technique, run this check: Is this geometric/vector art? → SVG. Is this a photo with no transparency? → JPEG or WebP. Is this a photo with transparency? → WebP lossy + alpha. Is this a UI element, screenshot, or flat graphic that genuinely needs PNG? → Then compress it as described above.

7. Compress your PNG files now

All the techniques described in this guide — metadata stripping, color type reduction, lossy quantization, and lossless DEFLATE recompression — are built into the Rebrixe PNG Compressor. It runs entirely in your browser. Your images never leave your device.

Compress your PNG files — free, instant, private

Lossless and lossy modes. Metadata stripped automatically. No signup required. Runs entirely in your browser — your files stay on your device.

Launch the PNG Compressor →

Need a different format? We have dedicated compressors for every common image type:

Need to convert PNG to WebP? WebP beats PNG on file size for almost every web use case.
Open WebP Compressor →
Working with JPEG files? Quality-controlled JPEG compression with live preview.
Open JPEG Compressor →
Have logos or icons to optimize? Strip redundant markup from Figma, Illustrator, or Inkscape SVGs.
Open SVG Compressor →

9. Frequently asked questions

What is the best PNG compression technique for web use?
For most web images, a two-pass approach works best: first run pngquant for lossy palette quantization (quality 85–100), then pass the output through OxiPNG for lossless DEFLATE recompression. Always strip metadata before or during this process. This combination typically achieves 60–80% file size reduction with no visible quality change.
What is the difference between lossless and lossy PNG compression?
Lossless PNG compression (OxiPNG, Zopfli) recompresses the DEFLATE stream without changing any pixel values — the decoded image is bit-for-bit identical to the original. Lossy PNG compression (pngquant) reduces the number of colors via palette quantization, which technically changes pixel values but is visually imperceptible at quality settings of 80 or above. Lossless typically saves 5–25%; lossy typically saves 50–80%.
How much can you compress a PNG file?
It depends on the content. Flat graphics with few colors can compress 70–80% with lossy quantization and look identical. Complex images with many colors might achieve 40–60%. Lossless-only compression typically achieves 5–25%. For photographs stored as PNGs, the correct answer is usually to switch formats — converting to WebP or JPEG can achieve 70–90% reduction over the original PNG.
Does compressing a PNG reduce its quality?
Lossless compression never reduces quality — the pixels are identical before and after. Lossy compression (palette quantization) technically changes pixel values but is visually indistinguishable from the original at quality 80+. The exception is images with extremely subtle gradients, text anti-aliasing, or precise brand colors — always verify the output at 100% zoom before publishing.
Should I use PNG or WebP in 2026?
For anything requiring transparency on the web, WebP is almost always the better choice. WebP lossless is 25–34% smaller than equivalent PNG, and WebP lossy with alpha is 60–80% smaller at comparable visual quality. WebP has 97%+ global browser support as of 2026. Use PNG when the toolchain, platform, or workflow explicitly requires it — keep your master files as PNG for editing, but export WebP for delivery.
What metadata should I strip from a PNG?
For web use, strip tEXt, iTXt, zTXt (software strings, author fields), iCCP (replace with the 3-byte sRGB chunk), gAMA, cHRM, bKGD, pHYs, and sBIT chunks. These have no effect on how a browser renders the image. Stripping saves 5–30 KB per file and is also a privacy measure — images captured on phones embed GPS coordinates in metadata that would otherwise be served to anyone who downloads the file.
What is palette quantization in PNG compression?
Palette quantization maps the full RGB/RGBA color space — potentially millions of distinct colors — down to the 256 most perceptually important colors for that specific image. The output is an indexed-color PNG that stores each pixel as a single byte (a palette index) rather than 3–4 bytes of color data. Tools like pngquant use perceptual color spaces and Floyd-Steinberg dithering to make this reduction visually imperceptible at high quality settings.
Why is my PNG larger after compressing it?
Some tools add metadata they don't strip (software tags, color profiles), which increases file size. Others apply a PNG filter strategy less optimal for your specific image content, making the DEFLATE stream less compact. Occasionally, tools convert indexed PNGs to RGBA, which is far less efficient. If this happens, check the output file's chunk list and compare color type against the input. Run OxiPNG with the --strip all flag to ensure metadata is not added back.
← Back to Guides