FormatterHQ

HSV to RGB Converter

Convert hue, saturation and value into 0–255 red, green and blue channels. Works with hsv(), hsb() or plain numbers.

Loading tool…
Ready.

How to use the HSV to RGB Converter

  1. Type or paste an HSV value into the HSV field, for example hsv(146, 67%, 55%).
  2. Use degrees for hue and percentages (or 0–1 fractions) for saturation and value.
  3. The RGB field shows rgb(r, g, b) with whole-number channels as you type.
  4. Copy the result with the button next to the field into your code, shader constants or image editor.

HSV to RGB conversion explained

HSV is the natural model for generating colors in code: sweep the hue for a rainbow, lower the value for a darker variant, lower the saturation for a washed-out one. Screens, image files and most APIs still want red, green and blue, and this HSV to RGB converter does that translation as you type.

The formula this tool uses

Instead of branching on six hue sectors, the converter uses a compact equivalent. With S and V as fractions and H in degrees:

k(n) = (n + H / 60) mod 6
f(n) = V − V × S × max(0, min(k, 4 − k, 1))

R = 255 × f(5)    G = 255 × f(3)    B = 255 × f(1)

Worked example: hsv(146, 67%, 55%)

Here V × S = 0.55 × 0.67 = 0.3685 and H / 60 = 2.4333.

R: k = 1.4333 → min(1.4333, 2.5667, 1) = 1       → f = 0.55 − 0.3685        = 0.1815 → 46
G: k = 5.4333 → min(5.4333, −1.4333, 1) → max 0 → f = 0.55                 = 0.55   → 140
B: k = 3.4333 → min(3.4333, 0.5667, 1) = 0.5667  → f = 0.55 − 0.3685×0.5667 = 0.3412 → 87

hsv(146, 67%, 55%)  →  rgb(46, 140, 87)

The green channel is the largest because 146° lies in the green-to-cyan part of the wheel, and it equals V × 255 exactly. The smallest channel is V × (1 − S) × 255.

Values from code libraries

Different libraries scale HSV differently, so check the ranges before pasting numbers here:

  • Python colorsys uses 0–1 for all three, including hue. Multiply hue by 360 and the others by 100.
  • OpenCV 8-bit images store hue as 0–179 (degrees divided by 2) and S and V as 0–255. Double the hue and divide S and V by 2.55.
  • Design tools show degrees and percentages, which you can paste directly.

Fractions work too: in hsv(207, 0.61, 0.71) the saturation and value are read as 61% and 71%, giving rgb(71, 131, 181).

Rounding and round trips

Every result is rounded to whole channel values. The example hsv(146, 67%, 55%) was derived from seagreen, rgb(46, 139, 87), but rounding its value to 55% pushes green up to 140. With one decimal, hsv(146, 66.9%, 54.5%) returns rgb(46, 139, 86), closer still.

Converting the other way is handled by RGB to HSV. If you need an alpha channel, use HSV to RGBA, or go straight to a code with HSV to HEX.

Convert HSV to RGB in Python

Python ships this conversion as colorsys.hsv_to_rgb(), which expects hue, saturation and value as fractions between 0 and 1 and returns red, green and blue on the same scale. Divide the hue by 360 and the percentages by 100 first, then multiply each channel by 255 and round. Forgetting to scale is the common mistake, and it is a silent one: the call does not fail, it returns numbers far outside the 0–1 range, as the last line of the example shows.

import colorsys

def hsv_to_rgb(h, s, v):
    """h in degrees (0-360), s and v in percent (0-100)."""
    r, g, b = colorsys.hsv_to_rgb(h / 360, s / 100, v / 100)
    return round(r * 255), round(g * 255), round(b * 255)

for hsv in [(9, 72, 100), (207, 61, 71), (146, 67, 55)]:
    print(hsv, "->", hsv_to_rgb(*hsv))

# Unscaled input does not raise an error, it returns nonsense
print(colorsys.hsv_to_rgb(9, 72, 100))

Enter the same HSV values in the converter above to confirm that the rounded RGB results match.

Frequently asked questions

What is the formula for HSV to RGB?
Compute chroma C = V × S, X = C × (1 − |(H/60) mod 2 − 1|) and m = V − C, then pick the channel order from the hue sector and add m. The compact k(n) version used here gives the same answer without a six-way branch.
Why does saturation 0 give a gray?
With zero saturation there is no chroma, so all three channels equal V × 255. hsv(any, 0%, 50%) is therefore rgb(128, 128, 128).
My OpenCV HSV values give strange colors. Why?
OpenCV stores hue as 0–179 and saturation and value as 0–255 in 8-bit images. Double the hue and convert S and V to percentages before converting, otherwise the hue lands in the wrong place.
Does value 100% mean white?
Only when saturation is 0%. At 100% value and 100% saturation you get the pure hue, such as rgb(255, 0, 0) for hue 0. White needs full value and zero saturation.

Last updated October 3, 2026

Related tools

RGB to HSV Converter Convert RGB colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. CMYK to HSV Converter Convert CMYK colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. CMYK to RGB Converter Convert CMYK colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons. Colortone to HSV Converter Convert a named colour tone (e.g. steelblue, tomato) or any colour to HSV, with its tints, shades and tones. Colortone to RGB Converter Convert a named colour tone (e.g. steelblue, tomato) or any colour to RGB, with its tints, shades and tones. HEX to HSV Converter Convert HEX colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. HSV to RGBA Converter Convert HSV colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. HTML Color Names All 148 CSS and HTML colour names with HEX, RGB and HSL values. Search, switch between grid and table, and copy with a click. Image Average Color Finder Find the average and dominant colour of an image — useful for placeholders, card backgrounds and theme colours. Runs in your browser. Image Color Palette Extractor Extract the dominant colours of any photo or screenshot as a palette with percentages, then copy HEX codes or export CSS variables. Image Color Picker Pick exact pixel colours from an uploaded image with a zoom loupe. Get HEX, RGB and HSL values and keep a list of picked colours. RGB to CMYK Converter Convert RGB colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons.