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
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
| Hex | RGB | HSL |
|---|---|---|
| #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
| #FFFFFF | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| #FF0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) |
| #00FF00 | rgb(0, 255, 0) | hsl(120, 100%, 50%) |
| #0000FF | rgb(0, 0, 255) | hsl(240, 100%, 50%) |
| #FFFF00 | rgb(255, 255, 0) | hsl(60, 100%, 50%) |
| #00FFFF | rgb(0, 255, 255) | hsl(180, 100%, 50%) |
| #FF00FF | rgb(255, 0, 255) | hsl(300, 100%, 50%) |
| #808080 | rgb(128, 128, 128) | hsl(0, 0%, 50%) |
| #FFA500 | rgb(255, 165, 0) | hsl(39, 100%, 50%) |
| #F80 | rgb(255, 136, 0) | hsl(32, 100%, 50%) |
| #1E90FF80 | rgb(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
- Type or paste a hex code such as 1E90FF or #F80; the # is added for you. Or click the swatch and pick a color.
- Read the Red, Green and Blue boxes, the rgb() string under them and the HSL string with hue, saturation and lightness below that.
- 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 toolsRGB to Hex
Convert RGB to a hex color code and back: rgb(255, 136, 0) is #FF8800. Paste #abc, ff8800 or 255,136,0; each channel is a whole number 0 to 255.
Color Picker
Pick a color or type a HEX, RGB or HSL value to get the other two, the CSS and CMYK forms, and its WCAG contrast ratio on white, black or a second color.
Hex to RGBA Converter
Convert hex to rgba(): #007BFF is rgba(0, 123, 255, 1). Reads 3, 4, 6 and 8-digit hex or rgb()/rgba(), sets the opacity, and gives hsla() and 8-digit hex.
Color Palette Extractor
Extract 4 to 12 colors from an image by median cut and copy them as HEX, RGB, HSL or CSS variables, or download JSON; near-white is left out by default.
Color Mixer
Mix two to four hex colors by weight in OKLab, sRGB or linear light: red and blue at 50% give #8c53a2 in OKLab. Copy HEX, RGB, HSL, OKLCH or CSS color-mix().
Resistor Color Code Calculator
Read 4-, 5- and 6-band resistor color codes or SMD codes like 472 as ohms with tolerance, or type 4.7k to get its bands. Brown black red gold is 1 kΩ ±5%.