Color Tools

HEX to RGB Converter

Hex in, rgb() out.

  • Runs in your browser
  • Free, no signup

Enter a HEX colour. Any supported format is accepted, and the result updates as you type.

This box works in both directions — change it and the HEX value follows.

#4F8EF7

All formats

  • HEX —
  • HEX8 —
  • RGB —
  • RGBA —
  • HSL —
  • HSV —
  • CMYK —

Every value shown comes from one conversion of the colour above, so the HEX, RGB, HSL and CMYK rows always agree with each other.

Your colours are converted in this browser. Nothing is uploaded and nothing is saved.

Hex and RGB are the same information written two ways. Each pair of hex characters is one byte — one channel — expressed in base sixteen, so FF is 255 and 00 is 0. This page shows that conversion as you type, with the result ready to paste into CSS, canvas or a graphics API.

The result box works in both directions: change the rgb() value and the hex code follows, which makes it a converter rather than a one-way form.

How to use this tool

  1. Type or paste a hex code, with or without the #.
  2. Read the rgb() value beside it, or use the colour field to pick one instead.
  3. Edit the rgb() box directly if you already know the channel values — the hex code updates.
  4. Copy whichever value you need; the rest of the formats are listed below.

How the conversion works

Split #4F8EF7 into 4F, 8E and F7. Each is a base-16 number: 4F is 4×16+15 = 79, 8E is 8×16+14 = 142 and F7 is 15×16+7 = 247. That gives rgb(79, 142, 247) — the same colour, one step closer to what the screen does with it.

Alpha in both notations

An 8-digit hex code carries opacity in its last pair of digits, from 00 to FF. In CSS that becomes the fourth argument of rgba(), written as a decimal from 0 to 1 — so #4F8EF780 is rgba(79, 142, 247, 0.502). The page prints both forms when a colour is translucent, and neither when it is not.

Checking the answer

Round-tripping is the quickest test of any converter: convert the RGB value back to hex and you should land on the code you started with, digit for digit. This one does, for every hex value from #000000 to #FFFFFF — the pages in this suite are tested that way rather than by eye.

Frequently asked questions

What is #FFFFFF in RGB?

rgb(255, 255, 255) — every channel at full strength, which is white. #000000 is rgb(0, 0, 0).

What is 50% opacity as an rgba() value?

0.5, so rgba(79, 142, 247, 0.5). In an 8-digit hex code the same value is written as 80, because 128 out of 255 is about half.

Can I paste rgb(79 142 247) without commas?

Yes. The modern space-separated form is accepted, including the slash before an alpha value.

Do I need the hash on the hex code?

No. 4F8EF7 and #4F8EF7 are read the same way, though CSS requires the #.