CODDY Tool

HEX to RGB

Convert a hex colour code to RGB values.

Paste a hex colour and get the red, green and blue values immediately, in both modern rgb() syntax and as plain numbers. Handles three, four, six and eight digit hex, including alpha.

Everything you enter stays in this browser tab. Nothing is sent to our servers, logged or stored.

This is one of the thingsColor Converterdoes — open it for everything else it supports.

Loading tool…

What Color Converter supports

  • HEXThe web default, with optional alpha.
  • RGBRed, green and blue from 0 to 255.
  • HSLHue, saturation and lightness.
  • HSVThe model behind most colour pickers.
  • CMYKFour-colour process, for print.
  • OKLCHPerceptually even; modern CSS.

About HEX to RGB

A hex colour is RGB written in base 16. #4a49d8 is three pairs of digits: 4a is red, 49 is green, d8 is blue, each a number from 00 to ff — that is 0 to 255 in the decimal you are used to. The conversion is a change of notation, not of colour.

Doing it by hand means converting each pair separately, which is where mistakes creep in, particularly with the shorthand forms. #abc is not #0a0b0c; each digit is doubled, so it means #aabbcc. An eight-digit value adds a fourth pair for alpha, where ff is opaque and 00 is invisible.

RGB notation is worth having when you need to adjust opacity in code, when you are interpolating between colours, or when an API expects numbers rather than a string.

How to convert HEX to RGB

  1. Paste your hex code

    With or without the hash, in three, four, six or eight digits. The swatch also opens your system colour picker.

  2. Copy the RGB value

    The highlighted row gives CSS-ready rgb() notation. An alpha below 1 appears after a slash.

  3. Take the other formats if you need them

    HSL, HSV, CMYK and OKLCH are calculated at the same time, so there is no second conversion to run.

Frequently asked questions

How do I convert hex to RGB by hand?

Split the six digits into three pairs and read each as a base-16 number. The first digit is worth sixteen times its value, the second is worth its value. So 4a is 4×16 + 10 = 74. Repeat for green and blue.

What does the eight-digit hex form mean?

The fourth pair is the alpha channel. #ff000080 is red at 80 hex, which is 128 out of 255 — roughly 50% opacity. It is the equivalent of rgb(255 0 0 / 0.5).

Should I write rgb(74, 73, 216) or rgb(74 73 216)?

Both work everywhere. The space-separated form is the modern CSS syntax and takes alpha after a slash, as rgb(74 73 216 / 0.5), which replaces the separate rgba() function. Commas remain valid and are not deprecated.

Why would I need RGB when hex works everywhere?

Because hex is opaque to arithmetic. Fading a colour, mixing two colours or driving a channel from a variable all need the numbers separated out. Hex is for recording a colour; RGB is for calculating with one.

HEX to RGB is free to use with no account, no watermark and no usage limits. Last updated 14 August 2026.