Start a project

Tool 76 of 194 · Images

PNG Colour Quantiser

Shrink PNGs by cutting them to a palette: see the result next to the original and download a PNG-8 that's often a fraction of the size.

PNG Colour Quantiser

Your image

The sample is Malham limestone pavement by Paul Morris (CC0, via Wikimedia Commons). Your own image never leaves your browser.

Before and after

Full-colour PNG
Quantised PNG-8

Palette

Palette as hex

Palette colours

01

What it does

Cuts your image to between 2 and 256 colours with median cut or k-means, with optional dithering, and writes a true indexed PNG-8 that keeps transparency.

  • Median cut, or k-means seeded from median cut for better colours
  • 2 to 256 colours, with Floyd-Steinberg dithering on or off
  • Real indexed PNG-8 output, with transparency kept in a tRNS chunk
  • Bit depth chosen to suit the palette (1, 2, 4 or 8 bits)

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

A PNG-8 file, a side-by-side comparison, the palette and the size saved, with a Copy and a Download button on every result.

  • PNG
  • Quantisation
  • PNG-8
  • Image compression

Why it matters

A full-colour PNG stores up to four bytes for every pixel. Most graphics, screenshots and illustrations use far fewer distinct colours than that allows, so reducing them to a palette of 256 or fewer and storing one byte (or less) per pixel can cut the file by half or more with little visible change. This is what tools like pngquant do, and it's one of the biggest savings available for PNGs.

This quantiser picks the palette with median cut, which keeps splitting the colour space where it's busiest, or with k-means, which then refines those colours to fit the image more closely. Floyd-Steinberg dithering spreads the rounding error to neighbouring pixels, which hides banding in gradients at the cost of a little noise. The output is a true indexed PNG-8 written by the page's own encoder, with semi-transparent colours kept in the palette, so it works anywhere a PNG does.

How to use it

  1. Drop a PNG (or any image), or use the sample.
  2. Choose the number of colours and the method.
  3. Compare the two images and the file sizes.
  4. Download the PNG-8.

FAQ

How many colours do I need?

Icons and flat illustrations often look identical at 16 to 64. Screenshots usually need 128 to 256. Photos are better as JPEG, WebP or AVIF.

Should I dither?

For gradients and photos, yes: it hides banding. For flat graphics and pixel art, turn it off, as it adds noise and can make the file larger.

Does it keep transparency?

Yes. Transparency is part of each palette colour, so soft edges and shadows keep their alpha.

Is my image uploaded?

No. It's processed in your browser.

Credits and licences

Sample photo: Malham limestone pavement by Paul Morris, CC0, via Wikimedia Commons.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk