About the HEXA to RGB Color Converter
Hex and RGB are two ways of writing the exact same colour. A hex code such as #1D7DF2 is just three pairs of hexadecimal digits — one each for red, green and blue — while RGB writes those same channels as decimal numbers from 0 to 255. This converter reads a hex value and gives you the rgb() (or rgba()) equivalent you can paste straight into CSS, a canvas call, or a design tool that only accepts decimal channels.
How the conversion works
Each pair of hex digits is a base-16 number that you convert to base-10. Take #1D7DF2: the red pair 1D is (1×16)+13 = 29, 7D is (7×16)+13 = 125, and F2 is (15×16)+2 = 242. So #1D7DF2 becomes rgb(29, 125, 242) — the same blue, written two ways.
What the “A” in HEXA means
An 8-digit hex value carries a fourth pair for the alpha (opacity) channel — #1D7DF280. Alpha is still 0–255 in hex, but CSS rgba() expects it as a decimal fraction between 0 and 1, so 80 (128 in decimal) becomes 128 ÷ 255 ≈ 0.50, giving rgba(29, 125, 242, 0.5) — a half-transparent blue. This is why an 8-digit code is handy: it stores colour and transparency in a single token.
Shorthand hex
A 3-digit code like #0AF is shorthand where each digit is doubled: it expands to #00AAFF before conversion. The converter handles 3-, 6- and 8-digit inputs, with or without the leading #.
When you need RGB instead of hex
Hex is compact and dominates static CSS, but RGB wins whenever a channel has to be calculated: fading opacity with rgba(), mixing or lightening a colour in JavaScript, feeding values into a <canvas> or SVG script, or matching a brand colour inside design software that shows decimal channels. Round-tripping a colour to RGB also makes it easy to nudge a single channel and see the effect. To go the other way or pick colours visually, use the Color Code Converter; to sample colours from an image, try the tool above alongside our other design utilities.
Frequently Asked Questions
How do I convert a hex colour to RGB by hand?
Split the code into its red, green and blue pairs and convert each from base-16 to base-10. For #1D7DF2: 1D=29, 7D=125, F2=242, giving rgb(29, 125, 242).
What is an 8-digit (HEXA) colour code?
It adds a fourth pair for the alpha/opacity channel. #RRGGBBAA carries transparency, so #1D7DF280 is a 50% transparent version of #1D7DF2.
Why is the alpha shown as 0.5 and not 128?
Hex stores alpha as 0–255 (80 hex = 128), but CSS rgba() expects a 0–1 fraction, so 128 ÷ 255 ≈ 0.5.
Does it accept 3-digit shorthand and codes without the # sign?
Yes. A 3-digit code like #0AF expands to #00AAFF first, and the leading # is optional.
Is my colour data sent anywhere?
No. The conversion is pure arithmetic that runs in your browser; nothing is uploaded.