Skip to the content

HEX to RGB Converter

Type a HEX color code and read its red, green and blue values, ready to copy as rgb() for CSS.

With or without the #. Three digits work too.

In RGB

rgb(30, 144, 255)

Hue
210°Alpha
100%

In the other notations

Name

dodgerblueexact match

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

HEX to RGB by hand

The converter opens with #1e90ff. This is how that color gets from HEX to RGB, step by step.

  1. Split #1e90ff into three pairs: 1e for red, 90 for green and ff for blue.
  2. Each pair is a number in base 16. The letters a to f stand for 10 to 15, and the first digit counts sixteen times: 1e is 1 × 16 + 14 = 30, 90 is 9 × 16 + 0 = 144 and ff is 15 × 16 + 15 = 255.
  3. Written the CSS way: rgb(30, 144, 255).

Well-known colors in HEX and RGB

ColorHEXRGB
black#000000rgb(0, 0, 0)
white#ffffffrgb(255, 255, 255)
gray#808080rgb(128, 128, 128)
red#ff0000rgb(255, 0, 0)
orange#ffa500rgb(255, 165, 0)
yellow#ffff00rgb(255, 255, 0)
lime#00ff00rgb(0, 255, 0)
green#008000rgb(0, 128, 0)
cyan#00ffffrgb(0, 255, 255)
blue#0000ffrgb(0, 0, 255)
purple#800080rgb(128, 0, 128)
magenta#ff00ffrgb(255, 0, 255)

Short codes, capitals and a fourth pair

  • A code of three digits is shorthand in which every digit is doubled: #f80 means #ff8800.
  • Capitals make no difference. #1E90FF and #1e90ff are the same color.
  • A fourth pair of digits is the opacity. It is divided by 255, so #1e90ff80 becomes rgba(30, 144, 255, 0.5): 80 is 128, and 128 ÷ 255 is 0.502.
  • Two digits in base 16 count from 0 to 255, which is why RGB values stop there.

The color converter shows a color in all seven notations at once, with a picker to choose it by eye.

See all 8