RGB to HEX Converter
Convert RGB color values to a HEX code instantly, with a live swatch and color picker.
- Free, no account
- No watermark
- No usage limit
About the RGB to HEX Converter
Paste your RGB color and the hex code shows up right away, that's the easy part. The reason to use this one over the dozens of other rgb-to-hex boxes is what happens around it. You paste the color however you already have it, a full rgb(59, 130, 246) string copied straight out of your CSS or Chrome DevTools, and you get back the hex plus HSL, HSV, and CMYK at the same time, each on its own row with its own copy button.
Most converters make you chop that rgb(59, 130, 246) into three little number fields before they'll do anything, then they dead-end you at a single hex code. So the second a print vendor asks for CMYK, or you want the HSL to nudge the lightness, you're opening another tab and pasting the color again. Here one paste puts every common format in front of you at once.
How to use
- Paste or type your color into the input. A full
rgb(59, 130, 246)string is the obvious one for RGB, but a hex like#3b82f6, anhsl(217, 91%, 60%), or even a plain color name liketomatoall parse the same way. - Or click the picker to choose a color by eye. Drag around the color field and everything below updates live, which helps when you know the shade you want but not its numbers.
- Check the swatch. The big preview block fills with the exact color so you can confirm you pasted the right one before you copy anything.
- Copy the format you need. HEX, RGB, HSL, HSV, and CMYK each get their own row and copy button. Grab the hex for your stylesheet, or the CMYK if it's going to print.
- Copy a shareable link when you want to hand the exact color to someone. The button builds a URL that reopens this page already set to your color, handy for a Slack message or a design ticket.
If what you type isn't a real color yet, the input turns red and shows a short hint instead of guessing, so you can keep editing until it takes. Nothing you enter ever leaves the browser, because the whole thing runs on your machine, so it keeps working even if your wifi drops after the page has loaded.
What "paste anything" actually buys you
The universal input is the part worth leaning on. It reads any valid CSS color, so you're never translating your color into the one shape the tool demands. Pull rgb(59, 130, 246) out of the DevTools color inspector, paste it, and you're set. With a hex from a brand guide and the RGB and HSL wanted next to it, paste the hex instead. It converts in any direction, so an hsl value or a color name works just as well as rgb.
That set of five formats is the other half of it. Say you're building a component and the designer handed you rgb(59, 130, 246) as the accent. You paste it once and you've got the hex for the CSS, the HSL if you want a lighter hover state (bump the L value and re-enter it), and the CMYK ready if this ever goes to print, all from that one paste. A single-purpose rgb-to-hex converter gives you one of those and sends you hunting for the rest.
Named colors parse too, which is more useful than it sounds. Inherit a stylesheet full of slategray, tomato, and rebeccapurple and need the real hex values to hand a designer who's never heard of them? Paste the name and read the code.
How the conversion works, and the one place people slip
Each RGB channel is a number from 0 to 255. That's exactly the range one byte holds, and a byte is written as two hex digits, so every channel becomes a two-character pair and three channels make the six-character #RRGGBB code.
To do a channel by hand, divide the number by 16. The whole part is the first hex digit, the remainder is the second, with A through F standing in for 10 through 15. Taking 229 as the example, divide by 16 and you get 14 remainder 5. Fourteen is E, five is 5, so 229 is E5. Run red, green, and blue through that same step and join the three pairs in order.
The one thing that trips people up is small channels. A value like 5 converts to a single character, and you have to pad it to 05 to keep the pair two digits wide. Drop that leading zero and the six-digit code shifts over, the browser reads the wrong channels, and you get a color you never asked for. The tool pads automatically, but it's the number-one hand-conversion mistake, so it's worth watching for.
One handy shorthand while we're here: when every channel's two digits are a repeated pair, CSS lets you collapse the six-digit code to three. #FFCC00 can be written #FC0, and #FFFFFF becomes #FFF. It only works when all three pairs happen to repeat. This tool always gives you the full six-digit code, which is never ambiguous, and you can shorten it yourself when a color qualifies.
Common RGB to hex values
A handful of colors come up so often it helps to just recognize them:
rgb(0, 0, 0)is#000000, black, every channel off.- White is the opposite,
rgb(255, 255, 255)gives#FFFFFF. - Pure red,
rgb(255, 0, 0), is#FF0000, and only the first pair is lit. rgb(0, 255, 0)is#00FF00, the pure green CSS also callslime.- Blue lands at
#0000FFfromrgb(0, 0, 255). - Yellow is red and green at full with blue off,
rgb(255, 255, 0), so#FFFF00. rgb(128, 128, 128)is#808080, a middle gray, because all three channels match.
The pattern behind all of them: 0 always maps to 00, 255 always maps to FF, and whenever the three channels are equal you get a neutral gray with no color cast. The moment you spot digits other than 00 and FF in a code, you're looking at a blended shade.
Frequently asked questions
Can I paste an HSL value or a color name instead of RGB?
Yes. The input reads any valid CSS color, so hsl(217, 91%, 60%), a hex like #3b82f6, or a name such as slategray or rebeccapurple all work and produce the same five outputs. It's a color converter pointed at the rgb-to-hex job, and it converts whichever way you feed it.
Why is the hex code uppercase?
The HEX row comes out uppercase, like #3B82F6. Hex isn't case-sensitive, so #3b82f6 is the identical color and every browser reads them the same way. If your codebase prefers lowercase, copy the code and lowercase it, the color doesn't change.
What does the shareable link button do?
It copies a URL with your color baked into it. Open that link and the page loads already set to that color, every format filled in. It's an easy way to send a teammate an exact shade without describing it or attaching a screenshot.
I pasted an rgba() color with transparency. Where did the alpha go?
The hex stays six digits and describes the opaque color, since standard #RRGGBB hex has no room for opacity. When your rgba() value has an alpha below 1, the tool keeps it by adding an RGBA row to the output, so it isn't lost. If you specifically want opacity inside one hex string, that's the 8-digit #RRGGBBAA form, built by scaling the 0-to-1 alpha up to a 0-to-255 number and converting it like any other channel.
Do RGB and hex ever describe different colors?
No, not for the same values in the same color space. Hex is just those three RGB channels written in base 16, so rgb(255, 0, 0) and #FF0000 render as the same red in any normal sRGB browser. They'd only look different if one were read in a different color space, which doesn't happen with everyday web colors.
What if I type something that isn't a color?
The input goes red and shows a short example hint, and the swatch clears, rather than handing back a wrong result. A half-typed rgb(59, 13 just waits for you to finish, and the output snaps back the instant the value is valid again.
Is my color sent anywhere?
No. It all runs in your browser with client-side code, so your colors never touch a server and the copy buttons write straight to your clipboard. Even the shareable link is assembled locally, and the converter keeps working offline once the page has loaded.