Hex to RGB Converter

Paste a hex colour and get the RGB channels back instantly, along with HSL, HSV and CMYK, computed entirely in your browser.

#4B994A
  • HEX#4B994A
  • RGBrgb(75, 153, 74)
  • HSLhsl(119, 35%, 45%)
  • HSVhsv(119, 52%, 60%)
  • CMYKcmyk(51%, 0%, 52%, 40%)

CMYK is a naive conversion with no colour profile, so treat it as a starting point for print rather than a match. Contrast against white is 3.53:1 for reference.

How to use Hex to RGB

  1. 1Type or paste a hex code. The leading hash is optional and 3-digit shorthand works.
  2. 2Read the RGB channels off the second row, or any other notation below it.
  3. 3Click a row to copy that value to your clipboard.

What happens when you convert hex to RGB

The hex string is split into three pairs and each pair is read as a base-16 number. #4B994A becomes 4B, 99, 4A, which in decimal are 75, 153 and 74. That is the whole conversion, which is why it is instant and needs nothing but the string.

Nothing is lost. Hex and RGB are two ways of writing the same three bytes, so the round trip is exact in both directions.

The shorthand trap

Three-digit hex expands by duplicating each digit, not by padding it.

#F80 is #FF8800. The 8 in the middle becomes 0x88, which is 136 in decimal. The intuitive-but-wrong reading is that it becomes 0x80, which is 128, and the difference is small enough to slip past a glance and large enough to be visible when the two sit side by side.

Duplication is also why shorthand can only express a small subset of colours: both digits of every channel have to match. That is 16 possible values per channel instead of 256, so 4096 colours out of 16.7 million. If a hex code cannot be written as three digits, no shorthand exists for it.

When RGB is the notation you want

Alpha is the main one. rgb(75 153 74 / 0.5) states the opacity as a readable fraction, where the 8-digit hex equivalent ends in 80 and requires knowing that 80 is hex for 128, which is about half of 255.

Computed colour is the other. If a channel comes from a variable, a slider or an animation frame, handing three numbers to rgb() is direct, whereas building a hex string means converting each channel to base 16 and padding it to two characters.

Image and canvas work is the third. Pixel data is already integer channels, so converting to hex only to have something parse it straight back is wasted effort.

The other notations here

HSL gives you hue, saturation and lightness, which is the notation to use when you want to adjust a colour rather than specify one: nudging the hue or dimming the lightness is a single-number edit.

HSV matches what Photoshop and Figma show in their pickers. CMYK is there for print, though without an ICC profile it is an approximation rather than a match.

Frequently asked questions

Does the leading hash matter?
Not here. CSS requires it, but people copy values out of design tools and spreadsheets without it constantly, so this accepts both. The output always includes the hash, since that is what you paste into a stylesheet.
How does 3-digit shorthand expand?
Each digit is duplicated. #F80 becomes #FF8800, so the 8 becomes 0x88 (136), not 0x80 (128). Padding with zeroes instead is a common mistake and gives a visibly different colour.
What about an 8-digit hex code?
The last two digits are alpha. This tool reads the first six and reports the opaque colour, because every notation it outputs describes opaque colour. The transparency is not lost from your original, just not shown here.
Why do I need RGB when hex works in CSS?
Mostly for alpha and for computed values. rgb(75 153 74 / 0.5) is easier to read and edit than an 8-digit hex, and any colour built from variables or an animation is easier to assemble as three numbers than as a padded string.

More free tools