How to use the reduce image colors tool
- Choose an image or drop it on the box. JPG, PNG, WebP, GIF, BMP and AVIF files work, up to 25 MB and 16 million pixels. SVG does not.
- Type the number of colors you want, from 2 to 256. The preview updates after a moment.
- Compare the original and the reduced picture, and look at the palette: each color is shown with its hex code and the share of pixels that use it.
- Use Download PNG to save the result, or Copy the palette to paste the hex codes.
How median cut works
The tool lists the colors in your image, grouped in small bins so that nearly identical shades count together. It puts them all in one box, then repeatedly takes the box with the most pixels, finds the color channel (red, green or blue) with the widest spread, and splits the box in two at the point where each half holds about the same number of pixels. This goes on until there are as many boxes as colors you asked for.
Each box becomes one palette color: the average of the colors in it. Every pixel is then given the closest palette color, measured by the distance between the red, green and blue values. Pixels that are partly see-through keep their transparency, and fully transparent pixels are left alone. The result never has more colors than you asked for, and the page shows how many it really uses.
When fewer colors work well
Flat graphics, logos and screenshots lose little at 16 or 32 colors and can shrink a lot as PNG files. Photographs with smooth gradients show banding at low color counts, because no dithering is used to hide the steps. Try 64 or 128 colors for photos, and compare the two previews before saving.
The page limits images to 16 million pixels to keep your browser responsive; make larger pictures smaller first with the Image Resizer. To build a palette from scratch, see the Color Palette Generator, to convert between file types the Image Converter, and to shrink the file size the Image Compressor.
More file and image tools
To convert other files or inspect an image, try the PowerPoint Text Extractor, EPUB Text Extractor and ICS to CSV Converter.
Assumptions and limits
- The image is a JPG, PNG, WebP, GIF, BMP or AVIF file with up to 16 million pixels.
- Colors are grouped in bins of 8 values per channel when the palette is built, and each pixel takes the nearest palette color.
- No dithering is applied, so smooth gradients may show bands at low color counts.
- The image is processed in your browser and is never uploaded. The saved file is a PNG of the same pixel size.
Frequently asked questions
Why does the result use fewer colors than I asked for?
Two boxes can average to the same color, or the image may have fewer distinct colors than the number you asked for. The page counts the colors actually used.
Will the PNG be smaller than the original?
For flat graphics usually yes. For photos it can be larger, because PNG stores every pixel without the loss that makes JPG small. The saved size is shown after you download.
What is the difference between this and dithering?
Dithering scatters pixels of two colors to imitate in-between shades. This tool maps each pixel to one palette color without scattering, which keeps edges clean but shows bands in gradients.
Can I choose my own palette?
Not here. The palette is chosen from the colors in your image. Copy the hex codes if you want to use them elsewhere.