Skip to content
SocialTools

Hex To RGB

Type a six-digit hex code to get its red, green, and blue values and a CSS rgb() string you can copy.

What it does

Hex codes and RGB describe the same color in two notations: #1E90FF is simply the red, green, and blue channels written in base 16. This converter reads a six-digit hex code, with or without the leading #, and shows each channel as a number from 0 to 255 alongside a swatch so you can confirm it is the color you expected.

It is handy when a design tool, video editor, or spreadsheet asks for RGB numbers but your brand guide lists hex. It also helps when you want to add transparency in CSS by turning a hex code into an rgba() value by hand.

How to use it

  1. 1

    Type or paste a six-digit hex code into the Hex field. Include the # so the preview swatch renders; the values work either way.

  2. 2

    Check the color swatch to confirm it is the right color.

  3. 3

    Read the R, G, and B values and the CSS string in the stats grid.

  4. 4

    Click the copy button to copy rgb(r, g, b) for your stylesheet.

What you get

A color swatch, separate R, G, and B values from 0 to 255, and a copyable CSS string in the form rgb(30, 144, 255).

When to use it

Add transparency in CSS
Convert a brand hex to RGB, then add an alpha value yourself, for example rgba(30, 144, 255, 0.5).
Fill RGB fields in editors
Some video editors and Office apps only accept separate R, G, and B numbers. Copy them from the stats grid.
Check a hex code is valid
If no swatch or values appear, the code is not a valid six-digit hex, which catches typos in style guides.

Example

Input

#1E90FF

Output

R: 30
G: 144
B: 255
Copied: rgb(30, 144, 255)

1E is 30, 90 is 144, and FF is 255 in decimal, one pair of hex digits per channel.

Tips

  • Three-digit shorthand such as #FFF is not accepted. Expand it by doubling each digit: #FFFFFF.
  • Eight-digit hex codes with alpha (like #1E90FF80) are not supported; convert the first six digits and add the alpha in rgba().
  • Upper and lower case both work: #1e90ff and #1E90FF give the same result.
  • For HSL and matching palette colors from the same hex, use the color palette generator.

Questions

How do I convert hex to RGB by hand?

Split the six digits into three pairs and convert each pair from base 16 to decimal. For #1E90FF: 1E = 1 x 16 + 14 = 30, 90 = 9 x 16 + 0 = 144, FF = 15 x 16 + 15 = 255.

Why does nothing appear when I type #FFF?

The converter only accepts full six-digit codes. Write #FFF as #FFFFFF and the values will appear.

How do I get an rgba() value with transparency from a hex code?

Copy the rgb() string, change rgb to rgba, and add a fourth value between 0 and 1. For example, rgba(30, 144, 255, 0.25) is 25% opaque.