Using the converter
Type the three numbers from an HSV or HSB picker, hue first, such as 32, 100, 100. The hex code appears, ready to paste into CSS or a design file.
If your picker shows saturation and brightness from 0 to 255 rather than percentages, divide them by 2.55 first.
How HSV becomes hex
First turn HSV into red, green and blue. Chroma is C = V × S, X = C × (1 − |(H ÷ 60) mod 2 − 1|) and m = V − C. The hue's 60° sector decides which channel gets C, which gets X and which gets 0, and m is added to all three.
Multiply each by 255 and round. Then write each number as two hex digits: divide by 16, and the answer and the remainder are the digits, with 10 to 15 as A to F.
A worked example
For hsv(32, 100%, 100%), C = 1 × 1 = 1 and m = 0. H ÷ 60 = 0.533, so X = 1 × (1 − |0.533 − 1|) = 0.533. The hue is in the first sector, so red, green and blue are (1, 0.533, 0).
Times 255 that's 255, 136 and 0. 255 is FF, 136 ÷ 16 = 8 remainder 8, so 88, and 0 is 00. The hex code is #FF8800.
A colour wheel in hex
| Hue | Full colour (100%, 100%) | Tint (50% saturation) | Shade (50% value) |
|---|---|---|---|
| 0° | #FF0000 | #FF8080 | #800000 |
| 30° | #FF8000 | #FFBF80 | #804000 |
| 60° | #FFFF00 | #FFFF80 | #808000 |
| 90° | #80FF00 | #BFFF80 | #408000 |
| 120° | #00FF00 | #80FF80 | #008000 |
| 150° | #00FF80 | #80FFBF | #008040 |
| 180° | #00FFFF | #80FFFF | #008080 |
| 210° | #0080FF | #80BFFF | #004080 |
| 240° | #0000FF | #8080FF | #000080 |
| 270° | #8000FF | #BF80FF | #400080 |
| 300° | #FF00FF | #FF80FF | #800080 |
| 330° | #FF0080 | #FF80BF | #800040 |
HSV, HSB and HSL
HSV and HSB are two names for one model. Hue, saturation and value is the same thing as hue, saturation and brightness, and the numbers match.
HSL is different. Its third number, lightness, puts the pure colour at 50% and white at 100%, while HSV puts the pure colour at 100% value, and white is 0% saturation at 100% value. Their saturations differ too, so hsv(220, 75%, 80%) is hsl(220, 60%, 50%). CSS reads hsl() but has no hsv(), so use hex to HSL for a stylesheet.
Questions
Is HSB to hex the same as HSV to hex?
Yes. HSB and HSV are the same model under two names.
Why doesn't hex to HSV give back my exact numbers?
Hex has 256 steps per channel, and HSV here is rounded to whole numbers, so nearby HSV values can share a hex code.
Sources
Added and reviewed . What's new






