1. Home
  2. Color
  3. Color Mixer

Color Mixer

Blend two colors by ratio and get steps and CSS code.

For every format and option in one place, use Color Tools →

Runs in your browser · No upload
Any format works: HEX, RGB, HSL.
 
Any format works: HEX, RGB, HSL.
 

Mixes in a space where lightness and color feel even to the eye. Midpoints look natural.

Mixed color#a3718c rgb(163, 113, 140)
3 to 11, ends are A and B
B 0%
#3366cc
B 25%
#726fae
B 50%
#a3718c
B 75%
#d26b65
B 100%
#ff5b1f
CSS color-mix()
color-mix(in oklab, #3366cc 50%, #ff5b1f)
CSS gradient
linear-gradient(in oklab to right, #3366cc, #ff5b1f)

This blends screen light. Paint and pigment mix differently and give different results.

How to use

  1. Enter a HEX, RGB or HSL value for Color A and Color B, or pick them with the color pickers.
  2. Set the ratio with the Share of B slider. 0 is pure A, 100 is pure B and 50 is an even mix. Swapping A and B flips the share as well.
  3. Choose a blend method. The same two colors give different midpoints depending on the method.
  4. The preview on top is the mixed color. Set the number of steps (3 to 11) to list evenly spaced in-between colors from A to B as HEX.
  5. Copy the color-mix() and gradient code below straight into your CSS.

Methods compared

Method Calculation Character
sRGB Averages screen values (0 to 255) directly The simplest and most common
Linear RGB Removes gamma, mixes light intensity, then converts back Closer to mixing real light, so midpoints are brighter
OKLab Averages in OKLab coordinates that feel even to the eye Natural midpoints with even lightness

An even 50:50 mix in the three methods:

Color A Color B sRGB Linear RGB OKLab
#ff0000 #0000ff #800080 #bc00bc #8c53a2
#ffffff #000000 #808080 #bcbcbc #636363
#ff0000 #00ff00 #808000 #bcbc00 #d0a800
#3366cc #ff5b1f #996176 #be6197 #a3718c

An even mix of white and black is #808080 in sRGB, a much brighter #bcbcbc in linear RGB and a darker #636363 in OKLab. None is wrong. They differ in what is being averaged.

Steps and CSS code

Splitting #3366cc to #ff5b1f into 5 steps in sRGB gives #3366cc, #6663a1, #996176, #cc5e4a and #ff5b1f. In OKLab it is #3366cc, #726fae, #a3718c, #d26b65 and #ff5b1f, with brighter, more even midpoints.

color-mix() is a CSS color function, and its percentage is the share of the first color (A). With 30% of B you get color-mix(in oklab, #3366cc 70%, #ff5b1f). The gradient output uses the same idea as linear-gradient(in oklab to right, ...). This syntax needs a reasonably recent browser, so use the step HEX values if you must support older ones.

Things to keep in mind

  • This calculates mixing of screen light. Red and green light make yellow, but pigments mix differently: yellow and blue paint make green. On screen, mixing #ffff00 and #0000ff evenly gives gray (#808080), not green. For matching a paint color, see HEX to Paint Color Guide.
  • If a result falls outside the sRGB range, it is fitted to the nearest displayable color.
  • For lighter and darker versions of one color, use Color Shades Generator. For matching color schemes, use Color Palette Generator. For gradients across several stops, use CSS Gradient Generator.

Frequently asked questions

How do I find the midpoint of two colors?

Set the share to 50. Different methods give slightly different midpoints, so choose OKLab if you want the one that looks most natural.

What do red and blue make when mixed?

On screen values, an even sRGB mix is #800080, a purple. Depending on the method you can also get #bc00bc or #8c53a2.

Can it mix like paint?

No. This is additive mixing of light. Paint mixes subtractively and gives different results.

Is my color sent to a server?

No. All calculations run in your browser and nothing is sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.