← All tools

HEX to RGB Color Converter

Convert HEX color codes to RGB and back instantly in your browser, see the live swatch, and learn how each format works with a clear example.

HEX and RGB: two ways to write the same color

Every color you see on a screen is mixed from three lights: red, green and blue. Turn all three up and you get white; turn them all off and you get black. HEX and RGB are simply two notations for describing how bright each of those three channels should be. They point at the exact same color, so a good converter just translates between the two writing systems without ever changing the actual shade. That is what this tool does, entirely in your browser, while showing you a live swatch so you can confirm the result with your own eyes.

Red, green and blue light channels mixing into a glowing color swatch, illustrating HEX to RGB conversion
Every on-screen color is built from red, green and blue light at different intensities.

How to read a hex code

A hex color looks like #1E90FF. The hash sign just marks the start; the six characters after it are three pairs, written in the #RRGGBB pattern. The first pair is red, the second is green, the third is blue. Each pair is a number written in hexadecimal, meaning base 16, where the digits run 0-9 and then A, B, C, D, E, F stand for 10 through 15. One pair can hold values from 00 (the channel fully off) up to FF (fully on). In plain decimal that range is exactly 0 to 255, the same scale RGB uses. With 256 possible levels per channel, the six-digit form can describe 16,777,216 distinct colors.

Converting both ways, with a worked example

To go from HEX to RGB, split the code into its three pairs and convert each from base 16 to ordinary decimal. Take #1E90FF. The red pair is 1E: that is 1 multiplied by 16, plus 14 (E), which equals 30. The green pair 90 is 9 multiplied by 16, plus 0, which equals 144. The blue pair FF is 15 multiplied by 16, plus 15, which equals 255. So #1E90FF becomes rgb(30, 144, 255) — the familiar dodger blue.

Going the other way is the same process in reverse. Take each RGB number and write it as two hex digits. Pure red, rgb(255, 0, 0), gives FF, 00 and 00, which join into #FF0000. One thing worth remembering: if a value is below 16, you still need both digits, so 5 is written 05 and not just 5. The converter handles that padding for you, but it trips people up when they do it by hand.

A color swatch beside glowing red, green and blue channel sliders showing RGB values from zero to 255
Each channel slides from 0 to 255, which maps directly onto the 00 to FF hex range.

Where each format gets used

HEX is the everyday language of the web. CSS, HTML and most code you write reach for hex codes because they are compact and easy to copy. RGB tends to surface inside design and image tools — Figma, Photoshop, Sketch and Illustrator usually show sliders or fields in the 0-255 range, and screen-recording or video apps often expect RGB too. So you regularly grab a hex code from a stylesheet and need its RGB form to type into a design panel, or vice versa. That round trip is the whole reason a converter is handy. If you need to build a whole set of matching shades rather than translate one, our color palette generator is the better starting point, and you will find more utilities like this under developer tools.

Alpha, opacity and HSL

Both notations have an extended form that adds transparency. RGB becomes rgba(30, 144, 255, 0.5), where the fourth value is alpha — 0 is fully see-through and 1 is fully solid. HEX adds a fourth pair for the same purpose, giving an eight-digit #RRGGBBAA code; 80, for instance, is roughly 50 percent opacity. A few converters also offer HSL (hue, saturation, lightness), which describes color the way a human might — pick a hue on the wheel, then dial its vividness and brightness. HSL is a different mental model rather than a different palette, so it can be more intuitive when you want to nudge a color lighter or more muted without juggling three separate numbers.

Frequently asked questions

Is the hash sign part of a hex code?

The hash is a marker that tells CSS and design tools you are giving a hex color. The color itself is the six characters after it. Most tools accept the code with or without the hash and add it back for you.

What is the difference between a 3-digit and 6-digit hex code?

A 3-digit code is shorthand where each digit is doubled, so #1AF means #11AAFF. It only reaches 4,096 colors, while the full 6-digit form reaches over 16 million.

Why does my hex code have eight characters?

An 8-digit hex code adds a fourth pair for alpha, or transparency. The first six characters are still red, green and blue, and the last two set opacity from 00 (invisible) to FF (solid).

Are hex codes case sensitive?

No. #1e90ff and #1E90FF describe exactly the same color. Hexadecimal letters work the same in upper or lower case, so use whichever your team prefers.

Do HEX and RGB ever look different on screen?

No. When they describe the same channel values they are the identical color. Any visible difference comes from a typo or from one code including transparency that the other leaves out.

How many colors can a standard hex code show?

A 6-digit hex code offers 256 levels for each of the three channels, which multiplies out to 16,777,216 possible colors.