FormatterHQ

RGB to HSV Converter

Express RGB colors as hue, saturation and value, the model used by color pickers, image processing and computer-vision code.

Loading tool…
Ready.

How to use the RGB to HSV Converter

  1. Type or paste an RGB color into the RGB field, such as rgb(34, 139, 34) or 34, 139, 34.
  2. The HSV field updates as you type and shows hsv(h, s%, v%).
  3. Rescale the numbers if your library uses 0–1 or 0–255 ranges instead of degrees and percentages.

Convert RGB to HSV (HSB)

The RGB to HSV converter expresses a color as hue, saturation and value, the model behind color pickers, image-processing scripts and computer-vision filters. RGB mixes three lights; HSV separates which color it is (hue) from how pure it is (saturation) and how bright it is (value), which makes it far easier to select or adjust colors by rule.

The formula

Scale R, G and B to 0–1, then use max, min and d = max − min:

V = max
S = d / max                      (0 if max = 0)
H = 60 × ((G − B) / d mod 6)     if max = R
    60 × ((B − R) / d + 2)       if max = G
    60 × ((R − G) / d + 4)       if max = B
    0                            if d = 0

Worked example: forest green

rgb(34, 139, 34)
R = 0.1333   G = 0.5451   B = 0.1333
max = 0.5451 (G)   min = 0.1333   d = 0.4118
V = 0.5451                  → 54.5%
S = 0.4118 / 0.5451         → 75.5%
H = 60 × ((0.1333 − 0.1333) / 0.4118 + 2) = 120
→ hsv(120, 75.5%, 54.5%)

Red and blue are equal, so the hue is exactly 120°, pure green. Compare the HSL version of the same color, hsl(120, 60.7%, 33.9%): the hue is identical, but the saturation differs and HSL lightness is unrelated to value.

HSV in code: check the scale

Libraries rarely use the degrees-and-percent notation this tool prints, so rescale before comparing numbers:

WhereHue rangeS and V rangeForest green
This tool0–3600–100%120, 75.5%, 54.5%
Python colorsys0–10–10.333, 0.755, 0.545
OpenCV, 8-bit images0–179 (degrees ÷ 2)0–25560, 193, 139

OpenCV's halved hue range is a frequent source of bugs in color-thresholding code: a range written for 0–360° silently misses most colors. OpenCV also loads images in BGR channel order by default, so make sure you convert from the right order.

Practical notes

  • Hue is rounded to a whole degree, S and V to one decimal place, and fractional RGB input is rounded to integers first.
  • Any alpha value in the input is ignored, because HSV has no standard alpha form.
  • Pure black is hsv(0, 0%, 0%); greys have 0% saturation and hue 0.
  • CSS has no hsv() function, so use RGB to HSL for stylesheets.

To turn HSV back into screen values, use HSV to RGB or HSV to HEX.

Convert RGB to HSV in Python

colorsys.rgb_to_hsv() from the standard library converts RGB to HSV, on a 0–1 scale for both input and output. Divide each channel by 255 before the call, then multiply the hue by 360 and the other two values by 100 to get degrees and percentages. If you pass 0–255 integers directly, hue and saturation still come out right and only V is wrong (it equals the largest channel), which makes the bug easy to miss.

import colorsys

def rgb_to_hsv(r, g, b):
    """r, g, b as 0-255; returns degrees and percentages."""
    h, s, v = colorsys.rgb_to_hsv(r / 255, g / 255, b / 255)
    return round(h * 360), round(s * 100, 1), round(v * 100, 1)

print(rgb_to_hsv(255, 99, 71))    # (9, 72.2, 100.0)
print(rgb_to_hsv(70, 130, 180))   # (207, 61.1, 70.6)
print(rgb_to_hsv(46, 139, 87))    # (146, 66.9, 54.5)

# Skip the division and V comes back on the 0-255 scale
print(colorsys.rgb_to_hsv(255, 99, 71))

The rounded results match what this converter shows for the same three colors, so you can paste your own RGB values above to verify a script.

Frequently asked questions

Is HSV the same as HSB?
Yes. Value and brightness are two names for the same thing: the largest of the three RGB channels. Design apps tend to say HSB, programming libraries HSV.
What is the difference between HSV and HSL?
Both use the same hue. In HSV, 100% value with 100% saturation is the pure color, while in HSL the pure color sits at 50% lightness and 100% lightness is always white.
Why is my OpenCV hue half of this value?
For 8-bit images OpenCV stores hue as degrees divided by 2 so it fits in one byte (0–179). Divide this tool's hue by 2 to compare, and scale saturation and value from percent to 0–255.
What is the HSV value of white?
White is hsv(0, 0%, 100%): full value and no saturation. Black is hsv(0, 0%, 0%), and any grey sits between them with 0% saturation.

Last updated October 3, 2026

Related tools

HSV to RGB Converter Convert HSV colour values to RGB 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. RGB to RGBA Converter Convert RGB colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. RGBA to CMYK Converter Convert RGBA colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. RGBA to HEX Converter Convert RGBA colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. RGBA to HSL Converter Convert RGBA colour values to HSL instantly, with a live colour swatch preview, colour picker and copy buttons. RGBA to HSV Converter Convert RGBA colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. RGBA to RGB Converter Convert RGBA colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons.