Skip to main content
CalcChef

Hex to RGB Color Converter

Type a hex color code such as #1E90FF or the short #F80 to get its RGB and HSL values: #1E90FF is rgb(30, 144, 255) and hsl(210, 100%, 56%). How it works

Use the Hex to RGB Color Converter

RGB
rgb(0, 0, 0)
Hex #000000
RGB string
rgb(0, 0, 0)
HSL string
hsl(0, 0%, 0%)
Hue
0°
Saturation
0%
Lightness
0%

Preview

About the Hex to RGB Color Converter

Hex #1E90FF is rgb(30, 144, 255) and hsl(210, 100%, 56%). Each pair of hex digits is one channel from 0 to 255: 1E = 1 × 16 + 14 = 30, 90 = 9 × 16 = 144 and FF = 15 × 16 + 15 = 255. This hex to RGB converter reads 6-digit codes, the 3-digit shorthand such as #F80 and 8-digit codes with an alpha pair, and shows R, G and B, the rgb() string and the HSL string with its hue, saturation and lightness.

Common hex colors in RGB and HSL

HexRGBHSL
#000000rgb(0, 0, 0)hsl(0, 0%, 0%)
#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)
#FF0000rgb(255, 0, 0)hsl(0, 100%, 50%)
#00FF00rgb(0, 255, 0)hsl(120, 100%, 50%)
#0000FFrgb(0, 0, 255)hsl(240, 100%, 50%)
#FFFF00rgb(255, 255, 0)hsl(60, 100%, 50%)
#00FFFFrgb(0, 255, 255)hsl(180, 100%, 50%)
#FF00FFrgb(255, 0, 255)hsl(300, 100%, 50%)
#808080rgb(128, 128, 128)hsl(0, 0%, 50%)
#FFA500rgb(255, 165, 0)hsl(39, 100%, 50%)
#F80rgb(255, 136, 0)hsl(32, 100%, 50%)
#1E90FF80rgb(30, 144, 255)hsl(210, 100%, 56%)

What the converter shows for each code. #F80 is shorthand for #FF8800, and the last pair of #1E90FF80 is alpha, which the converter drops.

How to use this tool

  1. Type or paste a hex code such as 1E90FF or #F80; the # is added for you. Or click the swatch and pick a color.
  2. Read the Red, Green and Blue boxes, the rgb() string under them and the HSL string with hue, saturation and lightness below that.
  3. Copy one channel, the rgb() string or the hsl() string.

Frequently asked questions

What does a 3-digit hex code like #F80 mean?
It is shorthand: each digit is doubled, so #F80 is #FF8800, which is rgb(255, 136, 0). Only codes whose pairs repeat a digit have a short form; #1E90FF has none.
What happens to the last two digits of an 8-digit hex code?
They are the alpha (opacity) pair, from 00 for fully transparent to FF for opaque. This converter reads the first six digits and drops the alpha, so #1E90FF80 gives rgb(30, 144, 255). For an rgba() value with the opacity kept, use the Hex to RGBA Converter.
Why is #F808 invalid?
The converter accepts 3, 6 or 8 digits. CSS also allows a 4-digit #RGBA shorthand, but this page reports it as invalid; the Hex to RGBA Converter reads it.
How do I convert RGB back to hex?
Write each channel as two hex digits and join them: 30 is 1E, 144 is 90 and 255 is FF, so rgb(30, 144, 255) is #1E90FF. This page converts one way only; the RGB to Hex tool does the reverse.
How do I convert hex to HSL?
Convert to RGB first, then scale each channel to 0–1. Lightness is the average of the largest and smallest channel, saturation is their difference divided by 1 − |2L − 1|, and hue is the position of the largest channel on the color wheel. #1E90FF gives hsl(210, 100%, 56%) and #808080 gives hsl(0, 0%, 50%); the page rounds each value to a whole number.

Related Tools

View all tools