Hex to RGB Converter

Paste a hex colour like #ff6347 or #f00 and get the matching rgb() value instantly, plus the same colour in HSL, HSV and CMYK if you need it.

Files never leave your device
rgbrgb(255, 99, 71)
hex#ff6347
hslhsl(9, 100%, 64%)
hsvhsv(9, 72%, 100%)
cmykcmyk(0%, 61%, 72%, 0%)

What a hex colour actually encodes

A six-digit hex colour is three bytes written back to back, one byte per channel, in the order red, green, blue. Each byte is written as two hexadecimal digits rather than a decimal number because two hex digits map onto a byte exactly: the range 00ff covers 0–255 with nothing left over and nothing missing. RGB is the same three numbers in decimal, which is why converting hex to RGB is not really a colour operation at all — it is a base conversion, digit pair by digit pair.

Reading the pairs by hand

Take #ff6347. Split it into ff, 63 and 47. Each hex digit is worth a power of 16, so a pair reads as (first digit × 16) + second digit. For ff that is (15 × 16) + 15 = 255. For 63 it is (6 × 16) + 3 = 99, and for 47 it is (4 × 16) + 7 = 71. Put the three together and you get rgb(255, 99, 71) — a warm, coral red.

The same steps on #1e90ff give 1e = 30, 90 = 144, ff = 255, so rgb(30, 144, 255), a saturated blue. Notice the pattern: ff is always 255 and 00 is always 0, because f is the largest single hex digit (15) and two of them is the largest possible byte.

Tip: Reaching for a calculator every time gets old fast. This page does the pair-by-pair math for you and keeps HSL, HSV and CMYK visible at the same time, so you only convert once no matter which format the rest of your code needs.

Shorthand and alpha

CSS allows a 3-digit shorthand when every pair would repeat a digit. #333 expands to #333333, which is rgb(51, 51, 51) — a neutral dark grey. #08f expands to #0088ff, which is rgb(0, 136, 255). The rule is mechanical: each digit is written twice, so #08f can only ever stand for one specific colour, never an approximation of it.

An 8-digit hex code adds a fourth pair for alpha. #ff634780 is the tomato red from above with 80 appended — 80 in hex is 128 in decimal, and 128 out of 255 is just over half, so the browser renders it at roughly 50% opacity: rgba(255, 99, 71, 0.5). A plain 6-digit code carries no alpha pair and is always fully opaque.

Tip: An 8-digit hex code is the only hex form with transparency built in. If you're pasting a code from a design tool and the RGB comes back opaque when you expected it translucent, check whether two digits were trimmed off the end.

Hex, RGB and HSL side by side

All three describe the same colour space; they just make different things easy to read.

FormatLooks likeEasiest to read off
Hex#ff6347A short string to paste into CSS or a design tool
RGBrgb(255, 99, 71)The raw channel intensities, 0–255 each
HSLhsl(9, 100%, 64%)Hue, and how light or saturated the colour is

When you actually need RGB

Hex is what you paste; RGB is what code often wants to compute with. A canvas drawing API, a shader uniform, or a colour-blending function typically takes three numbers, not a six-character string, so converting is the first step before the colour is usable in a program rather than a stylesheet. Design tools also tend to display RGB in an inspector panel even when the swatch was picked as hex, so this conversion is one you will do in both directions constantly once you start working across CSS and code.

Frequently asked questions

How do I convert a hex colour to RGB by hand?
Split the six digits into three pairs and read each pair as a base-16 number. In #ff6347 the pairs are ff, 63 and 47, which are 255, 99 and 71 in decimal, so the colour is rgb(255, 99, 71). Each pair covers one channel and always lands between 0 and 255.
What does a 3-digit hex code like #08f expand to?
Each digit is doubled to make a pair: 0 becomes 00, 8 becomes 88, and f becomes ff, giving #0088ff. That is rgb(0, 136, 255) — a shorthand is only valid when both digits of every pair would already match, so it can only reach a fraction of the 16.7 million colours full hex can.
Why do some hex codes have eight digits instead of six?
The extra pair is alpha, the opacity channel. #ff634780 is the same red as #ff6347 with 80 in hex — 128 out of 255 — appended, which is roughly 50% opaque. Six-digit hex has no alpha at all; the colour is assumed fully opaque.
Is hex case-sensitive?
No. #FF6347, #ff6347 and #Ff6347 all parse to the same rgb(255, 99, 71). Letters a through f (or A through F) just stand for the decimal values 10 through 15, and case carries no meaning in that mapping.
Can a hex pair ever be outside 00–ff?
No — that is exactly why hex is a safe format to store a colour in. Two hex digits cover 0 to 255 and nothing else, so a channel can never overflow the way a hand-typed RGB number sometimes does.
Does this tool read hex without the leading hash?
Yes. ff6347 and #ff6347 parse identically; the hash is a CSS convention this tool does not require. 3-, 6- and 8-digit forms are all accepted with or without it.
Why is my RGB output slightly different from another site's?
It shouldn't be, for standard hex — the mapping is exact, not approximate, so two correct tools always agree on whole numbers. A difference usually means the other tool is reading a colour profile or rounding an alpha percentage rather than the byte value.