← Back to Home

PNG Optimization Best Practices

Practical steps to reduce PNG size while preserving quality and transparency.

By the CompressItAll team. Published 2025-10-26. Updated 2026-10-24.

Compress PNG images with our free tool

When to Use PNG

  • Logos, UI icons, screenshots, and graphics with sharp edges and text.
  • Assets requiring alpha transparency (semi‑transparent shadows, overlays).
  • Avoid for photographs; prefer WebP/AVIF/JPEG.

Reduce Colors with Palettes

Indexed color (palette) can dramatically shrink file size for graphics with limited colors, as described in the PNG specification (W3C) PLTE chunk definition. Aim for the smallest palette that maintains visual fidelity. This remains lossless within the selected palette. Palettes hold up to 256 entries.

Strip Unnecessary Metadata

Remove ancillary chunks (text, time, thumbnails) unless required, as allowed by the PNG specification (W3C). This reduces bytes without changing the image.

Minimize Dimensions

Export at the exact display size. Avoid shipping oversized assets, especially for UI elements.

Manage Transparency Thoughtfully

  • Use alpha only when necessary. Solid backgrounds compress smaller.
  • Prefer 8‑bit alpha over 16‑bit when possible.

Automate in Your Workflow

Integrate a batch compressor into CI or build steps to avoid regressions. See our Batch Compression Guide.

A Practical Order of Operations

PNG savings come from several independent steps, and the order matters because some steps change the pixels and others do not. Work from the changes with the most effect down to the safest ones.

  1. Resize first. Pixel count drives file size more than any other setting. If an icon displays at 64 pixels wide, a 512 pixel source is wasted bytes. Keep a larger copy for high-density screens only if the page actually serves it.
  2. Decide whether PNG is the right format. If the image is a photograph, switch to a lossy format. See AVIF vs WebP vs JPEG for that decision.
  3. Reduce color depth where the art allows it. Flat illustrations often survive a palette conversion with no visible change.
  4. Remove metadata and unused chunks. This never changes the picture.
  5. Run lossless recompression last. A better filter and DEFLATE pass shrinks the file with identical pixels.

Using the CompressItAll PNG Tool

Open the PNG compressor and add up to 5 files at a time. Pick Lossless when text and edges must stay exact, which suits screenshots and UI assets. Lossy mode uses a quality setting with a default of 85 and is better for PNGs that contain photographic content. Custom mode adds target size and maximum dimension fields, but they are not applied reliably yet, so read the results table, which shows sizes and a before and after view. Files travel to our servers over HTTPS, are deleted automatically after processing, and need no account. Download files one at a time or as a ZIP.

Choosing Between Lossless and Palette Reduction

AssetSuggested approachWhat to check
Flat logo, few colorsPalette reduction plus lossless passEdge smoothness against the background
UI screenshotLossless onlyText legibility at 100 percent zoom
Icon with soft shadowKeep 8-bit alpha, lossless passShadow banding on light and dark backgrounds
Gradient illustrationLossless, or consider WebP or AVIFVisible steps in the gradient after palette reduction
Photo saved as PNGConvert to a lossy formatFaces, skin and fine texture

Screenshots

Screenshots are the most common oversized PNGs. Capture only the region that matters instead of the whole screen, and capture at the scale you will display. Retina-class captures contain twice the width and height of a normal capture, which is four times the pixels, so scale them down if the page will not use the larger version. Hide notification badges, cursors and personal data before the capture, because noisy or private details add bytes and risk.

Transparent Images and Backgrounds

Check whether the transparency is real. Many exported PNGs carry an alpha channel that is fully opaque everywhere, which adds data for nothing. If the image always sits on a known solid color, flattening it onto that color removes the alpha channel. If it must work on any background, keep the alpha but avoid 16-bit channels. Always preview on both a light and a dark background, because a halo of leftover light pixels around a cut-out is easy to miss on white.

Common Mistakes

  • Saving a photograph as PNG because the editor defaulted to it.
  • Exporting at twice the needed size and relying on CSS to shrink it.
  • Applying palette reduction to a gradient and shipping visible banding.
  • Re-saving from an already reduced copy instead of from the original master.
  • Leaving interlacing on for small icons where progressive display gives nothing.

Troubleshooting

  • The compressed PNG is barely smaller. The file is probably already well optimized, or it is photographic. Reduce its dimensions or change format.
  • Edges look jagged after palette reduction. The palette was too small to hold the anti-aliasing shades. Allow more colors or stay lossless.
  • Colors look different in the browser. A color profile or gamma chunk may be involved. Convert the source to sRGB before exporting.
  • The result is larger than the original. Lossless recompression can occasionally give no gain on a file that was already tight. Keep the original in that case.

Checklist Before Publishing

  • The image is exported at its display size, or a deliberate larger size for dense screens.
  • Text and thin lines look sharp at 100 percent zoom.
  • Transparency looks right on light and dark backgrounds.
  • Metadata is stripped and no needless alpha channel remains.
  • The original master is stored somewhere safe, separate from the compressed copy.

For the theory behind these steps, read How PNG Compression Works. To compress a PNG file now, use the is png lossless tool. If you are handling many assets at once,the batch guide covers grouping and review.