CSS Portal

CSS Color-mix() Calculator

This tool is designed for designers, developers, and color enthusiasts who need precise control over color blending. Built on the CSS color-mix() specification, this tool lets you blend any two colors across 11 different color spaces, from traditional sRGB to perceptually uniform spaces like OKLAB and OKLCH. Whether you're creating design systems, fine-tuning brand palettes, or exploring color theory, you'll find the exact interpolation method you need with support for hue interpolation modes that give you complete creative control.

What sets this tool apart is its comprehensive output support for CSS Color Level 4 formats. Generate colors in HWB, LAB, LCH, OKLAB, and OKLCH alongside traditional formats like HEX, RGB, and HSL. With real-time alpha channel control, dynamic color variations, and visual gradient previews on every slider, you can see exactly how your colors blend before copying them to your clipboard. Perfect for modern web development where color precision and perceptual accuracy matter.

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!
CSS Color-mix() Calculator
Select Colors
Color 1
Alpha100%
Color 2
Alpha100%
Mix Ratio
Blend50% / 50%
Color Space
Quick Actions
Mixed Result
Color Variations
Output Formats
If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

About This Tool

What is Color Mixing?

Color mixing in digital design isn't as simple as combining paint on a canvas. Different color spaces produce dramatically different results when blending the same two colors. This tool implements the CSS color-mix() function, which allows you to blend colors in various color spaces, each with unique perceptual characteristics. Traditional RGB mixing happens in a linear space that doesn't match human color perception, while perceptually uniform spaces like OKLAB create blends that look more natural to our eyes.

Understanding Color Spaces

This tool supports 11 different color spaces for mixing:

  • sRGB / sRGB Linear: Standard web color space and its linear variant
  • HSL: Hue, Saturation, Lightness - intuitive for designers
  • HWB: Hue, Whiteness, Blackness - simpler than HSL
  • LAB: Perceptually uniform, device-independent
  • LCH: LAB in cylindrical coordinates (Lightness, Chroma, Hue)
  • OKLAB: Improved perceptual uniformity over LAB
  • OKLCH: OKLAB in cylindrical form - best for gradients
  • XYZ (D50/D65): CIE color space with different white points

Hue Interpolation Methods

For cylindrical color spaces (HSL, HWB, LCH, OKLCH), hue is circular-0° and 360° are the same color. This means there are two paths between any two hues. The tool offers four interpolation methods: Shorter takes the quickest route around the hue wheel, Longer goes the long way for more dramatic transitions, Increasing always moves toward higher hue values, and Decreasing always moves toward lower values. These choices dramatically affect gradient appearance.

Output Formats

Every color mix generates 17 different output formats, ensuring compatibility with any project. From classic HEX codes to cutting-edge CSS Color Level 4 formats like OKLAB and OKLCH, you can copy the exact format you need. Alpha channel support is included across all formats, with both legacy syntax (rgba, hsla) and modern CSS syntax (rgb with / separator) provided for maximum flexibility.

Features at a Glance

  • Real-time mixing with instant visual feedback
  • Alpha channel control with gradient preview sliders
  • Color variations generator creates tonal scales automatically
  • Quick actions for randomization, swapping, and inverting
  • One-click copying for any output format
  • Multiple input formats (HEX, RGB, HSL) for each color
  • Professional-grade accuracy using standard color conversion formulas
  • Responsive design works on desktop, tablet, and mobile

Frequently Asked Questions

What is the CSS color-mix() function?

color-mix() is a CSS function that blends two colors together in a specified color space and returns the resulting color. It takes three arguments: the color space to interpolate in, the first color (with an optional percentage), and the second color (with an optional percentage). For example, color-mix(in oklch, red 50%, blue 50%) produces an equal blend of red and blue calculated in the OKLCH color space. It is part of the CSS Color Level 4 specification and is the native CSS way to mix colors without JavaScript or preprocessors.

What color spaces does color-mix() support?

color-mix() supports 11 color spaces: srgb, srgb-linear, hsl, hwb, lab, oklab, lch, oklch, xyz, xyz-d50, and xyz-d65. Rectangular spaces (sRGB, LAB, OKLAB, XYZ) interpolate each channel independently. Cylindrical spaces (HSL, HWB, LCH, OKLCH) treat hue as a circular value, which means there are two possible paths between any two hues - controlled by the hue interpolation method.

Which color space gives the best results with color-mix()?

For most use cases, oklch and oklab produce the most perceptually natural-looking blends because they are designed to be perceptually uniform - meaning equal numerical steps correspond to equal perceived differences in color. srgb is the most widely understood but can produce muddy or desaturated midpoints when mixing complementary colors. hsl and hwb are intuitive for designers but the circular nature of hue means blends can shift unexpectedly depending on the hue interpolation method chosen. For gradients and tonal scales, oklch is generally the best starting point.

What are hue interpolation methods in color-mix()?

Hue interpolation methods only apply to cylindrical color spaces (HSL, HWB, LCH, OKLCH) where hue is expressed as an angle on a color wheel. Because hue is circular, there are always two routes between any two hue values - a shorter arc and a longer arc. shorter takes the smallest angle between the two hues (the default and usually what you want). longer goes the long way around the wheel, producing more dramatic colour transitions. increasing always moves toward higher hue values regardless of which direction is shorter. decreasing always moves toward lower hue values. These choices can completely change the appearance of a blend - for example, mixing red and blue via the shorter route gives purple, but via the longer route passes through yellow and green first.

What is the difference between OKLAB and LAB in color-mix()?

Both LAB and OKLAB are perceptually uniform color spaces designed so that equal numerical changes correspond to equal perceived color differences. OKLAB is a more recent refinement of LAB that corrects for certain inaccuracies in LAB's uniformity, particularly in blue and high-chroma regions. In practice, blends using oklab tend to maintain more consistent perceived lightness and saturation through the midpoint than lab. OKLCH is the cylindrical form of OKLAB (adding a hue channel), and is generally the recommended choice for gradients and color scales in modern CSS.

What does the percentage value in color-mix() control?

The percentage next to each color controls how much of that color contributes to the final blend. color-mix(in srgb, red 70%, blue 30%) produces a result that is 70% red and 30% blue. If both percentages add up to less than 100%, the remainder is treated as transparent, effectively reducing the overall opacity of the result. If only one percentage is specified, the other is automatically calculated as the remainder to 100%. If neither is specified, both default to 50%, producing an equal blend.

What browsers support color-mix()?

color-mix() is supported in all modern browsers: Chrome 111+, Firefox 113+, Safari 16.2+, and Edge 111+. CSS Color Level 4 output formats such as oklab() and oklch() have similar but slightly varied support across browsers, so check current compatibility before using them in production. For maximum compatibility in your generated CSS, traditional formats like HEX, RGB, and HSL are safe across all browsers including older versions.

Can color-mix() handle transparent colors and alpha channels?

Yes. color-mix() supports alpha channel mixing alongside the color channels. When two colors with different alpha values are mixed, the resulting alpha is interpolated in the same way as the other channels. For example, mixing a fully opaque red with a fully transparent blue at 50% each produces a color with 50% opacity. Additionally, if the two percentages provided sum to less than 100%, the shortfall is added as a transparent component, which reduces the overall alpha of the result even if both input colors are fully opaque.

What is the difference between sRGB and sRGB Linear in color-mix()?

Standard srgb interpolates colors in gamma-encoded space, which is how colors are stored in most images and CSS values. srgb-linear first converts colors to a linear light representation before interpolating, then converts back. Linear mixing more closely reflects how light physically combines and avoids the darkening that can occur at the midpoint of sRGB blends - a well-known issue when mixing light and dark colors in gamma-encoded space. For a 50/50 blend of black and white, srgb-linear produces a perceptually mid-grey, while srgb can appear slightly darker than expected.

How do I use color-mix() in my CSS?

Use color-mix() anywhere a color value is accepted in CSS - in properties like color, background-color, border-color, CSS custom properties, and so on. The syntax is: color-mix(in <color-space>, <color1> <percentage>, <color2> <percentage>). For example: background-color: color-mix(in oklch, #3366ff 60%, white); produces a tint of blue mixed with 40% white in the OKLCH color space. You can also use it inside CSS custom properties to build dynamic design tokens: --brand-tint: color-mix(in oklab, var(--brand-color) 80%, white);

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!