HEX to RGB converter

Paste any HEX color and get its RGB value instantly, together with every other format: HEX, RGB, HSL, HWB, CMYK and OKLCH. Free, and it runs in your browser.

  • Free
  • No sign-up
  • Runs in your browser
hex-to-rgb

Fill in the values above to see the result.

100% private — the calculation is done in your browser and nothing is sent to any server.

How it works

Enter the color

Type or paste a HEX code, or pick a color with the color picker.

Read the RGB value

Every format updates as you type and shows a live preview of the color.

Copy it

Use the copy button next to the format you need.

How to convert HEX to RGB

To convert HEX to RGB, enter your HEX color in the box above and read the RGB value next to it. For example, #3B82F6 is rgb(59, 130, 246). The result updates as you type, and every other format (HEX, RGB, HSL, CMYK and more) is shown at the same time.

What HEX and RGB mean

A HEX color is a six-digit hexadecimal code with a # in front: two digits each for red, green and blue, from 00 to FF. In #3B82F6, red is 3B, green is 82 and blue is F6. A three-digit shorthand such as #38F repeats each digit, and eight digits add opacity at the end.

RGB describes a color as amounts of red, green and blue light, each from 0 to 255. rgb(59, 130, 246) is the same color as #3B82F6. CSS also accepts an opacity value, as in rgba(59, 130, 246, 0.5).

Convert HEX to RGB by hand

Here is the calculation for #3B82F6, step by step:

  1. Split the code into three pairs: 3B, 82 and F6.
  2. Convert each pair from hexadecimal to decimal (first digit × 16 + second digit): 3B = 59, 82 = 130, F6 = 246.
  3. Write them as rgb(red, green, blue): rgb(59, 130, 246).

HEX to RGB table of common colors

HEX to RGB
ColorHEXRGB
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
Red#FF0000rgb(255, 0, 0)
Lime#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Cyan#00FFFFrgb(0, 255, 255)
Magenta#FF00FFrgb(255, 0, 255)
Gray#808080rgb(128, 128, 128)
Orange#FFA500rgb(255, 165, 0)
Purple#800080rgb(128, 0, 128)
Pink#FFC0CBrgb(255, 192, 203)
Brown#A52A2Argb(165, 42, 42)
Navy#000080rgb(0, 0, 128)
Teal#008080rgb(0, 128, 128)
Coral#FF7F50rgb(255, 127, 80)

When to use HEX and when RGB

HEX is the most compact way to write a color in CSS and design tools, so it is the code most people copy and share. RGB is the model screens use and the one CSS functions such as rgba() build on, which makes it handy when you need transparency or want to compute colors in code.

Good to know

  • Shorthand HEX codes such as #38F expand to #3388FF, and eight-digit codes carry an opacity value at the end.
  • Values are rounded to whole numbers for display; the converter keeps more precision internally.
  • The color picker lets you pick a color by eye when you do not have its code.
  • Colors displayed on screen depend on your monitor's calibration, so the same code can look slightly different on different devices.

Frequently asked questions

How do I convert HEX to RGB?
Enter the HEX color in the converter at the top of this page and read the RGB value. For #3B82F6 the result is rgb(59, 130, 246).
What is HEX?
A HEX color is a six-digit hexadecimal code with a # in front: two digits each for red, green and blue, from 00 to FF. In #3B82F6, red is 3B, green is 82 and blue is F6. A three-digit shorthand such as #38F repeats each digit, and eight digits add opacity at the end.
What is RGB?
RGB describes a color as amounts of red, green and blue light, each from 0 to 255. rgb(59, 130, 246) is the same color as #3B82F6. CSS also accepts an opacity value, as in rgba(59, 130, 246, 0.5).
Can I convert to other formats at the same time?
Yes. The converter shows HEX, RGB, HSL, HWB, CMYK and OKLCH together, and you can copy any of them.
Is the conversion exact?
HEX and RGB carry exactly the same information, so converting between them is exact. HSL and CMYK values are rounded for display.
Is it free and private?
Yes. It is free, needs no sign-up and works in your browser, so the colors you type are never sent to a server.