RGB to HSV Conversion



RGB to HSV converter

Enter RGB hex code (#):  
or    
Enter red color (R):
Enter green color (G):
Enter blue color (B):
   
Hue (H): °  
Saturation (S): %  
Value (V): %  
Color preview:  


RGB to HSV Conversion

It is a color conversion calculator used to convert red, green and blue colors (RGB) to hue, saturation, and value (HSV). Hue is expressed in degrees while saturation and value are expressed as percentages. The RGB values range from 0 to 255 and the hex code is designated by both letters and numbers. To use the calculator, enter the RGB hex code in the initial blank text field and then click the ‘Convert' button. You can also enter the red, green and blue colors in their blank text fields respectively. The conversion result of hue, saturation, and value will be highlighted below the two controls. The bottom panel of the converter indicates the color preview of the HSV result. The ‘Reset' button is used when you want to perform new conversions from RGB to HSV

Example

Convert 127 red, 128 green, and 121 blue color codes into HSV.

Solution

First, enter the RGB values (69, 5.5 and 50.2) in their respective text fields. Initiate the conversion by clicking the ‘Convert' button. The conversion result will be displayed as;

Hue (H): 69 degrees

Saturation (S): 5.5%

Value (V): 50.2%

The color preview of the above HSV values can be visualized at the bottom panel of the converter.

Formula for converting RGB to HSV

To change the range from 0 to 255 into 0 to 1, the red, green and blue values are divided by 255.

 R' = R/255 G' = G/255 B' = B/255

Cmax = max(R', G', B')

Cmin = min(R', G', B')

Δ = Cmax – Cmin

Hue Calculation

0˚   Δ = 0

60 ˚ x (G'-B'Δmod6), Cmax = R'

60 ˚ x (B'-R'Δ+2), Cmax = G'

60 ˚ x (R'-G'Δ+4), Cmax = B'

Saturation calculation

0, Cmax = 0

Δ / Cmax, Cmax ≠ 0

Value calculation

V = Cmax