Tools / Color Converter / RGB → HSV

RGB to HSV Converter.

RGB to HSV maps the additive channels onto the hue/saturation/value cylinder used by virtually every color picker. If you're building a picker, eyedropper, or canvas tool, this is the conversion that turns a sampled pixel into pointer coordinates.

HSV —
All formats

    The RGB → HSV formula

    Normalize to 0-1. V = max(R,G,B). S = (max−min)/max (0 if max is 0). H = 60° times the offset of whichever channel is the max.

    Worked example

    Convert rgb(66, 123, 84):

    1. Normalize → (0.259, 0.482, 0.329)
    2. Value = 48%, max−min = 0.224, S = 46%
    3. Green is max → H = 60·(2 + (B−R)/range) ≈ 140°
    4. Result: hsv(140, 46%, 48%)

    JavaScript

    function rgbToHsv(r,g,b){
      r/=255;g/=255;b/=255;
      const mx=Math.max(r,g,b),mn=Math.min(r,g,b),d=mx-mn;
      let h=0; if(d){ h = mx===r?((g-b)/d)%6 : mx===g?(b-r)/d+2 : (r-g)/d+4; h*=60; if(h<0)h+=360; }
      return [Math.round(h), Math.round((mx?d/mx:0)*100), Math.round(mx*100)];
    }

    FAQ

    Why does a color picker use HSV?

    Because the 2-D square (saturation × value) plus a 1-D hue slider covers the whole gamut intuitively: move right for vivid, up for bright, slide for hue.

    Paid links below. As an Amazon Associate we earn from qualifying purchases.

    Library

    Colour references for your next project

    Compare the original references behind this archive. Check the contents, edition and format before choosing a book.

    Book links are Amazon Associates affiliate links. Your price is unchanged; a small commission supports the archive. As an Amazon Associate we earn from qualifying purchases.

    Torn between the two Wada dictionaries? Vol 1 vs Vol 2, compared plate by plate →

    Book links are Amazon Associates affiliate links. Your price is unchanged; a small commission supports the archive. As an Amazon Associate we earn from qualifying purchases.

    Looking for a combination we don’t have yet?

    Tell us the colour, mood, or palette you were after — it shapes which editorial combinations we add next.