HEX to RGB

Convert HEX to RGB, HSL and RGBA in your browser, with a WCAG contrast check included.

Free, no limit Nothing uploaded Works offline No sign-up

Every format at once, plus the number that actually matters

A hex code is just three bytes written in base 16. The first two are red, the next two green, the last two blue, each from 0 to 255. So #0439C3 is red 4, green 57, blue 195. There is nothing more to the conversion than reading pairs of digits.

What is more useful is seeing every representation together, because different tools want different ones. CSS accepts all of them, design software tends to prefer HSL, and RGBA is what you need the moment transparency is involved.

Underneath, the contrast ratio against white and against black is calculated using the WCAG formula. That is the figure accessibility audits check, and knowing your brand colour fails on white before you ship a site is considerably cheaper than finding out afterwards.

A hex colour code converted into RGB, HSL and contrast values

How to use it

Paste into the left box and the result appears in the right one as you type. Change any option and it recalculates immediately.

Copy puts the result on your clipboard and confirms it did. Download saves it as a file, which is the easier route when the output is long enough that selecting it by hand is a nuisance. Clear empties the boxes and puts the cursor back where you need it.

Where a sample button appears, it loads a small realistic example. It is there so you can see what the tool expects before pasting your own material, which is quicker than reading a description of the input format.

Keyboard and mobile

The text areas are ordinary form fields, so every shortcut your system already has works: select all, undo, redo, and paste without formatting. Tab moves between the panes and the controls in the order you would expect, and every control is reachable without a mouse.

On a phone the panes stack rather than sitting side by side, and the text areas grow to a comfortable height. Spellcheck and autocorrect are switched off in them, because a tool that silently capitalises your hex to rgb input is worse than useless.

If something looks wrong

When the result is not what you expected, the message under the boxes is the first thing to read. It reports what happened rather than a generic failure, so a malformed input names the line to look at and a successful run reports what it did, such as how many lines it kept or how many replacements it made.

A count of zero is informative in itself. It usually means the input did not contain what you thought it did, most often because of capitalisation or an invisible trailing space, both of which are far more common in pasted data than people expect.

Nothing is corrected silently. If the input cannot be handled, the output is left empty and the reason is stated, rather than a partial result being returned that looks plausible and is wrong. A tool that guesses is worse than one that says it could not.

Reading the contrast figures

The ratio runs from 1:1, meaning identical, to 21:1 for pure black on pure white.

  • 4.5:1 is the AA threshold for normal body text, and the one most audits check.
  • 3:1 is enough for large text, meaning 18pt or 14pt bold, and for interface components and graphics.
  • 7:1 is the AAA threshold, which is stricter than most sites achieve and worth aiming at for long form reading.

Shorthand hex is supported, so #f00 expands to #FF0000 by doubling each digit. Eight digit hex is supported too, where the last pair is the alpha channel: #0439C380 is the brand blue at 50 percent.

Colour notations, and when each one helps

CSS accepts several ways to write the same colour. They are equivalent to a browser and quite different to work with.

NotationExampleGood forAlpha
HEX#0439C3Brand values and design handoff8 digit form
RGBrgb(4, 57, 195)Generated colours and codergba()
HSLhsl(226, 96%, 39%)Building palettes and stateshsla()
NamedrebeccapurpleNothing seriousNo

Hex is the format brand guidelines are written in and the one designers hand over, which is the only real reason it dominates. As a way of thinking about colour it is useless: nothing about #0439C3 tells you it is a strong blue.

RGB is the same information in decimal, and it is what you want when a colour is being calculated rather than chosen, since the channels are ordinary numbers you can do arithmetic on.

HSL separates the three things people actually adjust. Want a darker variant for a hover state? Reduce the lightness. Want a muted version for a disabled control? Reduce the saturation. Both are one number, where the same change in hex means recalculating three unrelated values.

Modern CSS also has oklch, which fixes a real flaw in HSL: two colours with the same lightness value can look very different in brightness. For palettes that need to be perceptually even, it is the better tool, though support in design software is still catching up.

Safe to use with real data

Most online developer tools post whatever you paste to a server. For a toy example that is fine. For the payload you are actually debugging, which is a production API response with customer records in it, an internal configuration file or a token, it is a data disclosure that nobody signed off.

Everything on this page runs in your browser. The parsing, the conversion and the formatting all happen in memory on your own machine. Nothing is transmitted, nothing is logged, and there is no server that could keep a copy even if someone asked it to.

You can check that yourself: open your browser's network panel, paste something in and watch nothing happen. Then disconnect from the internet and use the hex to rgb tool anyway, because once the page has loaded it does not need the network again.

That constraint also shapes what we will build. Anything that genuinely requires a server, such as looking up a value in a database, is not something we can offer honestly under these terms, so we do not offer it at all.

No limits, and no account

There is no cap on how much text you can run through this, no daily quota and no sign up wall at the point where it becomes useful. The HEX to RGB tool costs us nothing to provide because it runs on your device rather than ours, so there is nothing to meter.

There is also nothing to install. It is one page of HTML, one stylesheet and one script, which together come to a fraction of the weight of a single photograph. It loads in well under a second on a phone connection and works immediately.

Why we built it this way

Developer tools that upload your input are a poor bargain. You get a conversion and they get your data, and the thing you pasted was usually the one piece of text you should have been most careful with. Running it locally removes the trade entirely.

The whole site is built on the same rule: if the work can be done in the browser, it is done in the browser. Over a hundred tools work that way, and the handful that genuinely cannot are the ones we have not built.

It also means the tool keeps working when we are not paying attention to it. There is no service to go down, no API key to expire and no rate limit to hit at the moment you need it most. The page you loaded is the whole program, and it will behave the same way in five years as it does today.

FAQ

HEX to RGB

The questions people ask most about this tool.

Split the six digits into three pairs and read each as a base 16 number. C3 is 12 times 16 plus 3, which is 195.

Each digit is doubled. #f00 is the same as #ff0000, so the shorthand only reaches colours where both digits of every pair match.

Six digits of colour plus two of alpha. #0439C380 is the same blue at roughly 50 percent opacity, since 80 in hex is 128 out of 255.

4.5:1 for normal text and 3:1 for large text or interface components, to meet WCAG AA. Both figures are shown above for white and black backgrounds.

Completely, with no account, no quota and no paid tier. It runs on your own device, so there is nothing for us to meter and nothing to charge for.

No. Everything happens inside this page, in memory on your machine. Nothing is transmitted, stored or logged, and you can confirm it by watching your browser's network panel while you type.

Yes. Once the page has loaded it never needs the network again, so you can disconnect and carry on working.

None that we impose. The practical limit is your device's memory, which on a modern machine is a very large amount of text.

Yes. The panes stack on a narrow screen and the controls stay reachable. Autocorrect is switched off in the input, so nothing is silently changed as you type.

Yes, freely and with no attribution required. What you paste is yours and so is what comes out.

Yes. A hex converter is this page under another name. There is one job here and several ways of asking for it.

Need a different conversion?

Over a hundred free tools, all running in your browser. Nothing is uploaded and nothing is capped.