Color average calculator
Paste a list of colors, one per line or separated by commas, and see their average calculated in three color spaces. The three answers differ, and the notes explain why.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Enter colors, one per line or separated by commas. Pasting
#ff0000, #0000ff works.
- Read the three averages. Each has a swatch, a HEX code and a Copy button.
How the three averages work
sRGB. Add the red values, divide by the count; same for green and blue. Red #ff0000 and blue #0000ff give #800080, because (255 + 0) / 2 = 127.5, rounded to 128.
Linear RGB. Each channel is first converted to linear light with the sRGB transfer function, averaged, and converted back. Red and blue now give #bc00bc: the linear value (1 + 0) / 2 = 0.5 becomes 188 after the curve.
OKLab. Colors are converted to OKLab, where L is lightness and a and b are color axes. The three numbers are averaged and converted back. The result is clipped to the sRGB range if it falls outside.
Worked example
Black and white: sRGB gives mid grey #808080, linear RGB gives the lighter #bcbcbc (half the light), and OKLab gives the darker #636363, because the midpoint of OKLab lightness is 0.5, which corresponds to only 12.5% of linear light.
Frequently asked questions
Why are there three different averages?
Colors are stored with a gamma curve, so the numbers are not proportional to light. Averaging the stored values (sRGB) is simple. Averaging after undoing the curve (linear RGB) treats colors as light. OKLab averages in a space designed so that equal steps look equal to the eye. For black and white they give #808080, #bcbcbc and #636363.
Which one should I use?
Use sRGB when you need to match what other software (CSS, image editors) reports. Use OKLab for the most natural-looking blend. Use linear RGB when you are simulating light, for example blurring or downscaling an image correctly.
Which color formats can I paste?
HEX with or without #, three or six digits, and rgb(), hsl(), hsv(), cmyk() and oklch() functions. Names such as "red" are not recognised. Entries that are not colors are counted and ignored.
Is the average of an image the same as the average of its colors?
Only if every color appears equally often. This tool treats each listed color as one equal vote; repeat a color on several lines to give it more weight.