Decrease PNG Color Count
Reduce the number of unique colors in a PNG image using median-cut quantization. Preview and download.
Original
Reduced Colors
Shrink a PNG by cutting unused colors — pick a target between 2 and 256 and median-cut quantization maps every pixel to the nearest match. Side-by-side preview shows the tradeoff before you download, so a 91,000-color banner can drop to 64 colors without looking wrong. And everything runs in your browser. Nothing gets uploaded.
How It Works
The median-cut algorithm reads every pixel, builds a 3D color cube from the RGB values, then splits that cube along whichever axis has the widest range. It keeps splitting until it hits your target number of buckets. Each bucket gets one representative color, and every pixel in that bucket adopts it. Alpha stays untouched — transparency is not part of the color reduction.
Examples
Shrinking a website hero image
A marketing page loads a 2400×800 PNG banner with subtle gradients. Dropping colors cuts the file size almost in half.
hero-banner.png
Dimensions: 2400 × 800
Unique colors: 91,204
File size: 3.8 MBhero-banner-reduced.png
Target: 64 colors
File size: 1.9 MB
Visual diff: minimal bandingCreating a retro pixel-art look
A game developer wants that 8-bit console aesthetic on a full-color character portrait.
character.png
512 × 512, 24-bit color
~14,000 unique colorscharacter-retro.png
Target: 16 colors
Distinct retro palette
File size: 38 KB (was 210 KB)Optimizing icons for an email template
Email clients choke on large embedded images. A designer has 12 icons that each use thousands of colors despite being simple flat shapes.
icon-set (12 PNGs)
Avg: 4,200 colors each
Avg size: 85 KB each
Total: ~1 MBReduced to 8 colors each
Avg size: 12 KB each
Total: ~144 KB
Looks identical at icon sizeWho Uses This
Cutting PNG weight to hit performance budgets without switching to lossy formats.
Forcing sprites into a strict palette for retro game engines that cap color count.
Shrinking inline images so newsletters don't get clipped by Gmail's 102 KB limit.
Simplifying chart exports before pasting into reports or slide decks.
Common Mistakes
Setting 8 colors on a sunset photo creates harsh color banding across the sky. For photos with smooth gradients, stay above 64 colors or the posterization will be obvious.
If the PNG already uses a 256-color palette (PNG-8), reducing to 128 won't save much. The big gains come from converting true-color PNGs (millions of colors) down to a limited palette.
Text and icons use semi-transparent edge pixels for smooth rendering. Aggressive color reduction can turn those smooth edges into jagged stair-steps. Keep at least 16–32 colors for anything with fine anti-aliasing.
Technical Details
- Processing: 100% client-side (Canvas API + JavaScript)
- Algorithm: Median-cut color quantization
- Color Range: 2 to 256 target colors
- Transparency: Alpha channel preserved, not quantized
- Browser Support: Chrome, Firefox, Safari, Edge
Frequently Asked Questions
How do I reduce the number of colors in a PNG?
Drop your PNG into the tool, drag the slider to your target color count, and click Apply. The median-cut algorithm maps all your existing colors into that many buckets. You'll see a before-and-after comparison right away so you can bump the number up or down before downloading.
Does reducing colors make the PNG file smaller?
Usually, yes — sometimes dramatically. PNG compresses by finding repeated patterns, and fewer unique colors means more repetition for the deflate algorithm to exploit. A 24-bit photo dropped to 32 colors can shrink by 60–80%. Flat illustrations see even bigger savings.
What is the median-cut algorithm?
It's a way of picking representative colors. Imagine all pixel colors as dots in a 3D box (red, green, blue axes). Median-cut slices that box in half along its longest side, then slices each half again, and keeps going until there are enough boxes to match your color target. Each box gets one average color. It's fast and produces natural-looking results.
Will this remove transparency from my PNG?
No. The alpha channel is left completely alone. Only the red, green, and blue values get remapped. Semi-transparent pixels keep their exact opacity, and fully transparent areas stay transparent.
Is my image uploaded anywhere?
Nope. The entire process runs locally in your browser using the Canvas API. Your file never hits a server. You could disconnect from the internet after loading the page and it would still work fine.