Free, in your browser

Convert colors

Colors as a shader wants them: paste hex, rgb() or Metal literals and get float3 or half3, in sRGB or linear light, with a swatch for each.

Colors

    SwatchHexMetal

    sRGB and linear light

    A hex color is sRGB: numbers bent to suit the eye, which is what the screen shows. Lighting math (adding lights, blending, averaging) wants linear light, where twice the number is twice the light. A shader that writes straight to the screen can use sRGB values as they are; one that lights a scene should convert its colors to linear first and back at the end, with the two functions on the third tab.

    What it reads

    Hex (#f93, #ff9632, with alpha #ff963280), CSS rgb() and rgba(), Metal float3, float4, half3 and half4 literals, and three or four bare numbers, 0 to 255 or 0 to 1. Several on a line, or one per line, with // comments. Click any hex or literal to copy it. The link in the address bar keeps the list.