Skip to main content

All RGB Colors in One Image

There are 16,777,216 RGB colors with 8 bits per channel (256 levels each for red, green and blue), and a 4096×4096 image has exactly that many pixels. Pick a layout, draw the image in your browser, count that every color appears exactly once and download it as a PNG.

Generate the image

Tiles layout of all 16,777,216 RGB colors, scaled down
Preview scaled down to 512×512: each pixel here averages 64 colors.
Layout

256 squares of 256×256, one per blue level. Red grows to the right, green downwards.

Drawn in your browser, nothing is uploaded. Tiles and Sorted by HEX take a few seconds. The Hilbert curve takes about 10 s in desktop Chrome and longer on a phone, and the page may pause while it draws.

The numbers

Each channel of an RGB color, red, green and blue, takes a value from 0 to 255. That gives 256 × 256 × 256 = 16,777,216 combinations, every HEX code from #000000 to #FFFFFF. A square image of 4096 × 4096 pixels has the same count, since 4096² = 256³ = 2²⁴, so it can hold each color once with nothing left over.

The colors make a cube, and a picture is flat, so none of the layouts here keeps every pair of similar colors side by side. Measured over all neighboring pixels, here is how often neighbors are one step apart:

LayoutNeighbors one step apartHow it is built
Tiles99.6%256 squares of 256×256, one per blue level. Red grows to the right, green downwards.
Hilbert curve65.9%A Hilbert curve is a path that visits every point and keeps nearby points together. The color cube is walked along a 3D one and laid on a 2D one: neighbors are close, with seams.
Sorted by HEX49.8%#000000 top left, then every code in order, row by row, to #FFFFFF bottom right.

ΔE2000 is a number for how different two colors look to people: about 1 is a common rule of thumb for the smallest difference noticed side by side. Between a color and its neighbor one step away in a single channel, like #804020 and #804021, the median ΔE2000 is 0.22 in a sample of 200,000 random pairs (sRGB, CIEDE2000), and 99.97% of them are under 1. The largest is about 1.2, in dark greys. So one step is almost always below what people notice, and banding you see mostly comes from where a layout puts its seams, not from the colors themselves.

Frequently Asked Questions

How many RGB colors are there?
With 8 bits per channel, the usual for web colors and HEX codes, each of red, green and blue takes 256 values, so there are 256 × 256 × 256 = 16,777,216 colors, from #000000 to #FFFFFF. This is what "16.7 million colors" or "24-bit color" means.
Why is the image 4096×4096?
4096 × 4096 = 16,777,216, exactly the number of 24-bit colors, so a square of that size has one pixel for every color with no repeats and no empty pixels. 4096 = 2¹², and 2¹² × 2¹² = 2²⁴.
Can people see all 16.7 million colors?
Not as separate colors. Two colors one step apart in one channel, like #804020 and #804021, differ by a median ΔE2000 of 0.22 in our sample of 200,000 random pairs, and 99.97% of such pairs are under ΔE 1, a common rule of thumb for the smallest difference people notice side by side. Up close the image looks like smooth gradients, not single dots.
Why can’t the image be smooth everywhere?
The colors form a cube with three axes, and the image is a square with two. No layout we know of keeps every pair of neighbors close: each one puts some colors that are far apart in the cube next to each other somewhere. Layouts differ in where these seams go.
Which layout is smoothest?
Measured over every pair of neighboring pixels: in the tiles layout 99.6% of neighbors are one step apart, in the Hilbert curve layout 65.9%, sorted by HEX 49.8%. Tiles are the smoothest, but their seams are long straight lines between tiles; the Hilbert layout breaks the seams up into short pieces.
Why PNG and not JPG?
PNG is lossless, so every pixel keeps its exact color. JPG compression changes colors slightly and would merge neighbors, so the image would no longer contain every color exactly once. For the same reason a copy re-saved by a social network or messenger is usually not the full set any more.

Sources

  1. Sharma G., Wu W., Dalal E. N. (2005). The CIEDE2000 color-difference formula: implementation notes, supplementary test data, and mathematical observations. Color Research & Application 30(1), 21–30. DOI
  2. Luo M. R., Cui G., Rigg B. (2001). The development of the CIE 2000 colour-difference formula: CIEDE2000. Color Research & Application 26(5), 340–350. DOI