W3C CSS4 HWB to HEX Converter
Convert HWB (Hue, Whiteness, Blackness) values to a HEX color code. Follows the CSS Color Level 4 algorithm, including gray normalization when W plus B is 100%.
Input
Result
#3B82F5rgb(59, 130, 245)hwb(217 23% 4%)Technical Specification & Mathematical Principles
How the HWB to HEX Converter Works
The CSS Color 4 algorithm first normalizes whiteness and blackness: if W + B >= 1, the result is the gray W / (W + B) on all channels. Otherwise it computes the fully saturated RGB of the hue (HSL with S = 100% and L = 50%).
Each channel of that pure hue is then scaled: channel = pure x (1 - W - B) + W. The result is multiplied by 255 and rounded to produce the 8-bit HEX channels. At W = 0 and B = 0 the output is the pure hue; at W = 100% it is white; at B = 100% it is black.
Frequently Asked Questions
What happens when whiteness plus blackness exceeds 100%?
Can hue be negative or above 360?
Why is the result sometimes one digit off from another tool?
Related Design & Color Instruments
HEX to HWB Converter
Convert HEX to HWB (Hue, Whiteness, Blackness) for CSS Color Level 4. Get the hwb() function, channel percentages and a live swatch in your browser.
HSL to HEX Converter
Transform cylindrical HSL coordinates into standardized 6-digit hexadecimal web color strings.
HSV to HEX Converter
Transform cylindrical HSV cone coordinates into standardized 6-digit hexadecimal web color codes.
RGB to HEX Converter
Convert decimal RGB integer components (0-255) to uppercase 6-digit padded hexadecimal strings.