HEX to HSV Converter

HEX to HSV: #FA5252 = hsv(0, 67%, 98%). See the formula worked step by step, a reference table, and our test of every HEX value.

How to use HEX to HSV

  1. 1Enter the HEX code from your style guide.
  2. 2Read H, S and V; these are the same numbers Photoshop calls HSB.
  3. 3For Android, iOS or Unity code, divide S and V by 100.

Features

  • HSV/HSB values that match picker squares
  • Open Color reference table
  • Round-trip precision measured over 16.7 million codes

How HEX to HSV conversion works

HSV (called HSB in Adobe and Apple software) describes a colour the way most colour-picker squares are laid out: hue around the ring, saturation left to right, value (brightness) bottom to top. From HEX, value is simply the brightest channel, and saturation is how much the dimmest channel falls short of it.

  • Decode the HEX pairs to R, G, B and divide by 255.
  • Cmax = max(R′, G′, B′), Cmin = min(R′, G′, B′), Δ = Cmax − Cmin.
  • V = Cmax.
  • S = 0 if Cmax = 0, otherwise Δ ÷ Cmax.
  • H is the same as for HSL: 60° × ((G′ − B′) ÷ Δ mod 6), ((B′ − R′) ÷ Δ + 2) or ((R′ − G′) ÷ Δ + 4) depending on which channel is largest.
  • Round: hsv(H, S%, V%).

Worked example: #FA5252 to HSV

Here is the converter's own calculation for #FA5252, step by step. The result, hsv(0, 67%, 98%), is exactly what the tool above shows for this input.

  • Split into pairs: FA, 52, 52.
  • Red: FA = 15 × 16 + 10 = 250.
  • Green: 52 = 5 × 16 + 2 = 82.
  • Blue: 52 = 5 × 16 + 2 = 82.
  • R′ = 250 ÷ 255 = 0.98, G′ = 0.322, B′ = 0.322.
  • Cmax = 0.98, Cmin = 0.322, Δ = 0.659.
  • V = Cmax = 0.98.
  • S = Δ ÷ V = 0.672.
  • Red is largest: H = 60° × ((0.322 − 0.322) ÷ 0.659 mod 6) = 0°.
  • Rounded: hsv(0, 67%, 98%).

Open Color, index 6 in HEX and HSV

The thirteen index-6 colours from Open Color, an open-source palette tuned for UI.

ColourHEXHSV
gray#868E96hsv(210, 11%, 59%)
red#FA5252hsv(0, 67%, 98%)
pink#E64980hsv(339, 68%, 90%)
grape#BE4BDBhsv(288, 66%, 86%)
violet#7950F2hsv(255, 67%, 95%)
indigo#4C6EF5hsv(228, 69%, 96%)
blue#228BE6hsv(208, 85%, 90%)
cyan#15AABFhsv(187, 89%, 75%)
teal#12B886hsv(162, 90%, 72%)
green#40C057hsv(131, 67%, 75%)
lime#82C91Ehsv(85, 85%, 79%)
yellow#FAB005hsv(42, 98%, 98%)
orange#FD7E14hsv(27, 92%, 99%)

Source: Open Color 1.9.1

Precision test: every HEX value through the converter

Whole-number HSV keeps slightly more of HEX than HSL does. Over all 16,777,216 codes the converter produced 2,475,339 distinct HSV values and 12.188% of codes survived the round trip exactly, with a worst drift of 3 levels (#0073FB came back as #0070FA) and an average of 0.9896.

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

MeasureResult
HEX values tested16,777,216
Distinct HSV results2,475,339
Came back exactly12.188%
Largest change (0–255 levels)3
Average change0.9896

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

Where you'll use HEX to HSV

Typing a brand colour into Photoshop or Figma's HSB fields

Photoshop's Color Picker shows H, S and B next to the # field, and Figma's picker can switch to HSB. Converting first tells you where the colour sits on the picker square, useful when you want a lighter variant that stays on the same hue.

Mobile and game code

Android's Color.colorToHSV(), iOS's UIColor(hue:saturation:brightness:alpha:) and Unity's Color.RGBToHSV() all work in HSV/HSB with values from 0 to 1, so divide the percentages on this page by 100.

Generating palettes programmatically

Rotating hue while keeping S and V fixed gives evenly bright colours for charts. The Open Color index-6 colours below are a good example: their V stays high while hue walks around the wheel.

Common mistakes

  • Writing hsv() in CSS: browsers don't support it. Convert to HEX, rgb(), hsl() or hwb() for stylesheets.
  • Assuming S means the same in HSV and HSL: pure white has S = 0 in both, but a pale pink can be 30% in HSV and 100% in HSL.
  • Forgetting the 0–1 scale in code APIs: Color.HSVToColor() on Android takes hue in degrees but saturation and value from 0 to 1.
  • Expecting V = 100% to mean white: it means the brightest channel is at full strength; white also needs S = 0%.

Frequently asked questions

Is HSV the same as HSB?

Yes. HSB (hue, saturation, brightness) is Adobe's and Apple's name for the same model; the numbers are identical.

Why is V for #FA5252 98%?

V is the brightest channel divided by 255. Red is FA = 250, and 250 ÷ 255 = 0.980, which rounds to 98%.

Can I use HSV in CSS?

No. CSS has no hsv() function. The closest is hwb(), which uses the same hue with whiteness and blackness; or convert to HEX or hsl().

How precise is HEX to HSV with whole numbers?

In our test of all 16,777,216 HEX codes, 12.188% came back unchanged after HEX → HSV → HEX, and none drifted by more than 3 levels per channel.

More text, code & dev tools