HSV to HEX Converter

HSV to HEX: hsv(45, 100%, 100%) = #FFBF00. See the formula worked step by step, a reference table, and our test of every HSV value.

How to use HSV to HEX

  1. 1Enter H, S and V (or Photoshop's H, S, B).
  2. 2Copy the HEX code for CSS or tokens.
  3. 3Lower V to get darker shades of the same colour.

Features

  • Exactly the colour your picker showed
  • Value ramp reference
  • Measured reach: about 13% of HEX codes

How HSV to HEX conversion works

An HSV colour comes from a picker: a hue around the wheel, saturation across the square, value up the square. To turn it into a HEX code you rebuild the three channels: value sets the brightest one, saturation sets how far the dimmest one drops, and hue places the middle one.

  • Scale S and V to 0–1.
  • C = V × S; X = C × (1 − |(H ÷ 60) mod 2 − 1|); m = V − C.
  • Pick (R′, G′, B′) by 60° sector, add m, multiply by 255 and round.
  • Write each channel as two HEX digits.

Worked example: hsv(45, 100%, 100%) to HEX

Here is the converter's own calculation for hsv(45, 100%, 100%), step by step. The result, #FFBF00, is exactly what the tool above shows for this input.

  • Chroma C = 1 × 1 = 1.
  • X = 1 × (1 − |(45 ÷ 60) mod 2 − 1|) = 0.75.
  • m = 1 − 1 = 0.
  • 45° is in the 0–60° sector, so (R′, G′, B′) = (C, X, 0) = (1, 0.75, 0).
  • Add m and multiply by 255: R = 255, G = 191, B = 0.
  • Red 255 = 15 × 16 + 15 → FF; green 191 = 11 × 16 + 15 → BF; blue 0 = 0 × 16 + 0 → 00.
  • Joined: #FFBF00.

A value ramp in HSV and HEX

Hue 45° at full saturation, value stepping down from 100% to 20%.

ColourHSVHEX
V 100%hsv(45, 100%, 100%)#FFBF00
V 90%hsv(45, 100%, 90%)#E6AC00
V 80%hsv(45, 100%, 80%)#CC9900
V 70%hsv(45, 100%, 70%)#B38600
V 60%hsv(45, 100%, 60%)#997300
V 50%hsv(45, 100%, 50%)#806000
V 40%hsv(45, 100%, 40%)#664D00
V 30%hsv(45, 100%, 30%)#4D3900
V 20%hsv(45, 100%, 20%)#332600

Precision test: every HSV value through the converter

Every whole-number HSV value becomes a HEX code that converts back to the same colour (100% of 3,672,360). They produce 2,193,881 distinct codes, about 13% of all HEX colours, so if you need one specific HEX code, pick it in HEX rather than via HSV.

Method: every whole-number HSV value, through the converter's own code and back, compared on the 0–255 scale (how we test).

MeasureResult
HSV values tested3,672,360
Distinct HEX results2,193,881
Came back exactly100%
Largest change (0–255 levels)0
Average change0

Last updated · Source: Pixohub exhaustive test of lib/color-math.ts

Where you'll use HSV to HEX

Handing picker colours to developers

Designers often read H, S and B from Photoshop or Procreate. Developers need HEX for CSS and design tokens, and this conversion gives exactly the colour the picker showed.

Generating a value scale

Holding hue and saturation and lowering V produces darker shades of the same colour, as in the value ramp below. These are darker but not greyer, unlike lowering HSL lightness past 50%.

Writing colour constants in code

Even if your colour logic is HSV-based, config files and CSS expect HEX.

Common mistakes

  • Typing HSB values from Photoshop into an HSL field: the colour will change.
  • Forgetting that V = 0% is always black, whatever H and S are.
  • Rounding before the final step, which can shift the HEX by one in a channel.
  • Expecting the HEX to round-trip to the same HSV: some HEX codes come back as a neighbouring HSV value.

Frequently asked questions

What is hsv(45, 100%, 100%) in HEX?

#FFBF00, an amber. V = 100% puts red at FF, S = 100% puts blue at 00, and a 45° hue puts green three quarters of the way up (191 = BF).

Is Photoshop's HSB the same as HSV?

Yes. Enter the H, S and B numbers from Photoshop as H, S and V here.

Does HSV to HEX lose quality?

No. The HEX code is exactly the colour the converter computed, and we confirmed that converting it back gives the same colour for all 3,672,360 whole-number HSV values.

Why can't I get #FFBE00 exactly with whole-number HSV?

Whole-number HSV reaches only about 2.19 million of the 16.7 million HEX codes, so many codes, including some close to common colours, sit between HSV grid points.

More text, code & dev tools