Convert HEX to RGB Hexadecimal ↔ Red Green Blue Free Online Secure
Type a value in HEX and read it in RGB at once. The arithmetic happens in your browser, nothing is sent anywhere, and what the conversion depends on is written out below rather than assumed.
Nothing uploaded
Where these notations come from
Hex and RGB are the same thing written twice. A screen colour is three numbers — how much red, green and blue light to emit — each from 0 to 255, which is one byte; hex simply writes those bytes in base sixteen, so #FF8800 and rgb(255, 136, 0) are the same instruction to the same pixel. HSL was invented because neither is readable by a human: it gives hue as an angle around a colour wheel, with saturation and lightness as percentages, so a designer can make something lighter without recomputing three figures. CMYK belongs to a different world altogether — ink rather than light. It is subtractive, built from four printing plates, and it cannot reach every colour a screen can, because a screen emits light while paper only reflects it.
Where you meet them
Hex is what you type into a stylesheet and what a design tool hands you. RGB appears wherever a colour needs arithmetic — gradients, transparency, code that computes a shade. HSL is what you reach for when adjusting a palette by hand, because the changes you want are usually changes of one of its three numbers. CMYK is what a printer asks for, and converting into it is the moment a design stops being light and becomes ink.
Questions people ask
Why does my CMYK result differ from what my printer gives me?
Because there is no single correct conversion. The arithmetic on this page is the simple, device-independent one, which is the right answer when you need a starting point or a rough equivalent. A print shop converts through a colour profile that accounts for the specific ink, paper and press, and the same RGB colour will produce different CMYK values on glossy stock than on uncoated. For anything that must match, ask the printer for their profile rather than trusting a formula.
Why can't some screen colours be printed?
Because the two cannot reach the same colours. A screen makes colour by adding light and can produce a vivid, saturated cyan or green that ink simply cannot match; paper makes colour by absorbing light, and the brightest it can ever be is the white of the page. The set of colours each can reach is called its gamut, and where they do not overlap, a conversion has to choose the nearest available colour. That is why a bright screen colour often looks slightly dulled in print.
Is the answer exact?
Where both units are defined in terms of one another by whole numbers, yes — the page says so above the figure, and the only rounding is in how many digits are shown. Where the ratio has no finite decimal, the page shows twelve significant digits and says the relation is approximate rather than pretending otherwise.
Does anything I type leave my device?
No. The arithmetic runs in your browser; nothing is uploaded and there is no server to upload it to. Load the page once and it keeps working with the network switched off.
Why you convert HEX to RGB
A design tool gives you a colour as #5A4632. A stylesheet, a canvas script, a chart library or a graphics program asks for it as rgb(90, 70, 50). They are the same colour, and the work of getting from one spelling to the other comes up all the time: a brand guide lists hex codes and your code needs numbers to compute a lighter shade, a client sends a colour from a logo and you have to fill an rgba() with transparency, a library accepts only three separate values. To convert HEX to RGB is a small task, and a reliable converter saves you from doing base-sixteen arithmetic in your head and getting it wrong.
The conversion is exact, which is not true of every colour conversion. Hex and rgb() are two spellings of the same three numbers, the amounts of red, green and blue light that a screen should emit, each from 0 to 255. Nothing is approximated, and a round trip returns what it started with. This page does it in your browser, and nothing is uploaded. Below you will find how hex digits map to the three numbers, how transparency is carried across, what the shorthand form does, the limits of sRGB, and the situations in which developers and designers need to convert HEX to RGB.
How the conversion works
Three pairs of digits become three numbers
A hex colour is a hash sign followed by six hexadecimal digits, which are read in pairs: the first pair is red, the second green, the third blue. Each pair is a number in base sixteen between 00 and FF, which is 0 to 255 in the decimal system you use every day. So #5A4632 splits into 5A, 46 and 32. 5A is 5 × 16 + 10 = 90, 46 is 4 × 16 + 6 = 70, and 32 is 3 × 16 + 2 = 50. The colour is rgb(90, 70, 50), which is the example the page starts with.
Why the digits go from 0 to F
Base sixteen needs sixteen symbols, so after 9 come the letters A to F, which stand for 10 to 15. A pair of such digits gives 16 × 16 = 256 values, exactly what one byte can hold. A screen colour is three bytes, and hex is simply a compact way of writing them: six characters instead of three numbers with commas and brackets.
Upper and lower case
#5a4632 and #5A4632 are the same colour. CSS accepts either, and so does this converter. Pick one convention for a project and keep to it, since mixed case makes searching a stylesheet harder.
What the conversion keeps and what it cannot
It keeps the colour, exactly
Hex and rgb() are two spellings of the same three numbers, 0 to 255 for red, green and blue, so nothing is approximated and a round trip returns what it started with. Convert HEX to RGB and back, and you have the same code you began with, with the possible exception of capital letters.
It carries transparency across
A fourth value for transparency is carried across too: #RRGGBBAA becomes rgba(), and back. The last pair is the alpha channel, from 00, fully transparent, to FF, fully opaque. So #5A463280 is rgba(90, 70, 50, 0.5), since 80 in hex is 128, and 128 out of 255 is about one half. Eight digits are accepted by all current browsers.
It cannot describe colours outside sRGB
Both spellings describe sRGB, the colour space a screen has used for thirty years. They cannot describe a colour outside it, which is what the newer CSS notations, lab(), oklch() and color(), exist for. Modern displays can show more saturated colours than sRGB holds, and a designer who picked such a colour in a wide-gamut tool will see it clipped to sRGB when it is written as hex.
Shorthand is expanded, not preserved
Shorthand is expanded rather than preserved: #abc comes back as #AABBCC, which is the same colour written the long way. Each digit is doubled. That means you can paste a three-digit code and get the right numbers, but you cannot recover the short spelling from the long one by looking at it, only by checking that each pair repeats.
Common colours and their numbers
A few to remember
White is #FFFFFF, which is rgb(255, 255, 255): all three lights at full power. Black is #000000, rgb(0, 0, 0): no light at all. Pure red is #FF0000, green #00FF00 and blue #0000FF. A mid grey is any code with three equal pairs, such as #808080, which is rgb(128, 128, 128). Equal pairs always mean grey, because equal amounts of the three lights give no hue.
Reading a code at a glance
Once you know the pattern you can estimate a colour from its hex digits. A code that begins with a high first pair is reddish, a high middle pair is greenish, a high last pair is bluish. #FF8800 is a lot of red, some green and no blue, which is orange. You do not need a tool for that, but you need one for the exact numbers.
How to convert HEX to RGB here
Type or paste the hex code
Enter the colour in the first field, with or without the hash sign. Three, six and eight digit forms are accepted.
Read the rgb value
The answer appears at once in the other field, in the form rgb(90, 70, 50), or rgba() if the code carried transparency. The page shows the sentence #5A4632 = rgb(90, 70, 50) so you can check at a glance.
Copy it into your code
Paste the result into the stylesheet, the script or the tool that asked for it. If you need the three numbers separately, they are the ones in the brackets.
Where these notations come from
Hex and RGB are the same thing written twice
A screen colour is three numbers, how much red, green and blue light to emit, each from 0 to 255, which is one byte. Hex simply writes those bytes in base sixteen, so #FF8800 and rgb(255, 136, 0) are the same instruction to the same pixel.
HSL and CMYK
HSL was invented because neither is readable by a human: it gives hue as an angle around a colour wheel, with saturation and lightness as percentages, so a designer can make something lighter without recomputing three figures. CMYK belongs to a different world altogether, ink rather than light. It is subtractive, built from four printing plates, and it cannot reach every colour a screen can, because a screen emits light while paper only reflects it. For those, see HEX to HSL and HEX to CMYK.
Where you meet them
In stylesheets
Hex is what you type into a stylesheet and what a design tool hands you. RGB appears wherever a colour needs arithmetic: gradients, transparency, code that computes a shade. Knowing both spellings, and being able to move between them, is part of everyday front-end work.
In scripts and canvas drawing
Drawing code often wants the three numbers separately, to blend two colours, to darken one by a fixed amount or to test whether a pixel matches a target. Converting HEX to RGB gives you the numbers directly.
In graphics and image tools
Image editors usually show a colour as three numbers or as a hex code, and let you type either. Moving between the two lets you reproduce a colour from a web page in a program that wants numbers.
In documentation and brand guides
A brand guide may list a colour in hex for the web, in RGB for screens and in CMYK for print. Having the first two agree is a matter of one conversion, and it is the kind of check that catches a typo before it is printed on a thousand leaflets.
Practical uses of the RGB form
Transparency without a second colour
With rgba(90, 70, 50, 0.5) you get the colour at half strength, so that what is behind it shows through. It is the standard way to make overlays, shadows and tinted backgrounds from a brand colour without inventing a new one.
Computing lighter and darker shades
To make a hover state slightly darker, a script can subtract a fixed amount from each of the three numbers. Doing the same on a hex string is awkward; on rgb it is simple arithmetic. If you need a hue-based adjustment, convert HEX to HSL instead.
Contrast checks
Accessibility tools calculate the contrast between two colours from their red, green and blue values. Having the numbers lets you do the calculation yourself, or paste them into a checker, to confirm that text on a background is readable.
Traps when you convert HEX to RGB
Forgetting the alpha pair
An eight-digit code has transparency in the last two digits. If you strip them off, you lose it. Check the length of the code before you decide that the result is the colour.
Mixing up the order
Hex is red, green, blue. A few formats, and some old graphics APIs, use blue, green, red. If a colour comes out wrong in a particular program, check its channel order.
Copying from a screenshot
A colour read from a screenshot is the colour after the screen's colour management and any compression. It may differ slightly from the colour in the source file. Use the design file when you can.
Assuming screens agree
Two screens show the same code slightly differently. The numbers are exact; what you see depends on the display and its profile.
Questions people ask before converting
What is #FF0000 in RGB?
rgb(255, 0, 0), pure red.
What is #FFFFFF in RGB?
rgb(255, 255, 255), white.
Can I convert a three-digit code?
Yes. Each digit is doubled: #09C becomes #0099CC, which is rgb(0, 153, 204).
Is the conversion exact?
Yes. It is two spellings of the same three numbers.
Is my colour uploaded?
No. The arithmetic runs in your browser and nothing is sent anywhere.
How do I go back?
With RGB to HEX, which writes the three numbers as a hex code.
Choosing wisely when you convert HEX to RGB
Know what you need next
If you need transparency, rgba() is the natural form. If you need to adjust lightness or hue, HSL is easier. If the colour is going to print, CMYK is the next step, with the caveats that conversion carries. See RGB to CMYK.
Keep the hex as the master
For colours in a brand palette, keep the hex code as the reference. It is short, unambiguous and understood everywhere. Derive the other forms from it when you need them.
Use custom properties
In CSS, define colours once, as --brand: #5A4632, and refer to them by name. If you need the numbers for rgba(), define --brand-rgb: 90 70 50 as well. The conversion is then done a single time.
Modern CSS and the RGB form
Space-separated syntax
Current CSS accepts rgb() with spaces and a slash for transparency, as in rgb(90 70 50 / 50%). The numbers are the same as in the comma form, so the result of a conversion works in both. Older browsers and some tools expect the commas, so the comma form remains the safe choice when you do not know where the colour will be used.
Percentages and fractions
RGB can also be written with percentages, such as rgb(35% 27% 20%), where 100 percent is 255. The page gives whole numbers because they are what hex stores and what most tools expect. If you need percentages, divide each number by 255 and multiply by 100.
Custom properties for the three numbers
A common trick is to store only the three numbers in a custom property, --brand-rgb: 90 70 50, and use it as rgb(var(--brand-rgb) / 0.5). It lets a single definition serve both solid and translucent uses. When you convert HEX to RGB for this purpose, copy just the numbers from the answer.
Working with colour in practice
Check against the brand guide
If a brand guide gives both hex and rgb for the same colour, convert one and compare with the other. A mismatch usually means a typo in the guide, and finding it before it is used on every page is worth the minute it takes.
Keep a palette as a short list
Most sites use five to eight colours. Write them in a note in both forms. Each time you need to convert HEX to RGB for a new component, you can look it up instead of working it out again, and the palette stays consistent.
Name colours by role
Names such as primary, surface and warning survive redesigns better than names such as green or brown. The conversion gives you the numbers; the name says what they are for.
Related converters
The same family of tools covers the neighbouring conversions. To go back, use RGB to HEX. For colours described by hue, HEX to HSL and HSL to HEX are at hand, and for print, HEX to CMYK, CMYK to HEX and CMYK to RGB. For the sizes in the same stylesheet, px to rem and px to em do for lengths what this page does for colours.
A worked example
Say your brand colour is #1E7A5C and you want a translucent version for a card background. You type the code and read rgb(30, 122, 92). In the stylesheet you write background: rgba(30, 122, 92, 0.12), a very light tint of the same green, and a border of rgba(30, 122, 92, 0.4). The card sits comfortably on a white page and on a grey one, because the transparency lets the page through. When the brand colour is later changed, you replace the three numbers in one custom property and every tint follows.
A short checklist
Before converting
Check the length of the code: three, six or eight digits. Decide whether you need transparency.
While converting
Paste the code, read the rgb value and copy it with its brackets, or the three numbers alone.
After converting
Test the colour in context, on the real background, and check the contrast of any text that sits on it.
Common mistakes
Dropping the transparency pair
Eight digits mean alpha. Keep it or convert it to rgba().
Confusing the channel order
Hex is red first. Some tools expect blue first.
Treating the screen as the truth
The numbers are exact. The look depends on the display.
Your colours stay on your device
The calculation happens locally. Your values are used by your own browser and nothing is sent anywhere. There is nothing to delete afterwards and no account to create. That is the plain way to convert HEX to RGB.
Summary
To convert HEX to RGB here, type or paste the hex code and read the rgb value at once. The conversion keeps the colour exactly: hex and rgb() are two spellings of the same three numbers, 0 to 255 for red, green and blue, so nothing is approximated and a round trip returns what it started with. A fourth value for transparency is carried across too, since #RRGGBBAA becomes rgba(), and back. Both spellings describe sRGB, so they cannot describe colours outside it, and shorthand is expanded rather than preserved: #abc comes back as #AABBCC. Nothing is uploaded.