My Tool Studio
Color

RGB to HEX

Legacy stylesheets love to mix rgb(24, 119, 242) with hex codes three lines apart, and design tool sliders hand you raw channel numbers rather than a copy-ready code. This rgb to hex converter cleans that up. Type or paste an rgb() string, an rgba() value, or even a bare comma-separated triple like 24, 119, 242, and the highlighted HEX row shows #1877F2 ready to copy in uppercase. Developers reach for it when normalizing a stylesheet to one notation, filling a hex-only form field in a CMS, or moving a color out of a screenshot eyedropper. The panel also translates your rgb color to hex code alongside HSL, HSV, CMYK, and OKLCH readings.

Always freeNo sign upRuns in your browser
hex#6366F1
rgbrgb(99, 102, 241)
hslhsl(239, 84%, 67%)
hsvhsv(239, 59%, 95%)
cmykcmyk(59%, 58%, 0%, 5%)
oklchoklch(58.54% 0.2 277.12deg)

How to use

01

Enter your RGB value

Type into the Input (RGB) field using rgb(r, g, b) form. The tool also parses rgba() strings and plain comma-separated triples, and it loads with rgb(99, 102, 241) as a working sample.

02

Confirm the swatch matches

Once the value parses, a wide preview swatch appears so you can eyeball the color before trusting the output. An unparseable entry shows a yellow warning instead of results.

03

Grab the hex code

In the results grid, the HEX row sits highlighted at the top of six formats. One click on its copy button puts the uppercase code, hash included, on your clipboard.

Why RGB to HEX

Common questions

How is an RGB channel like 242 turned into its hex pair?
Divide by 16: the quotient becomes the first hex digit and the remainder becomes the second. For 242, that's 15 remainder 2, written F2. Do it for all three channels and rgb(24, 119, 242) becomes #1877F2.
Can I paste an rgba() value with transparency into this converter?
Yes, rgba() strings parse fine. Keep in mind the standard 6-digit hex output describes only the opaque color, so an alpha of 0.5 won't survive into a code like #1877F2 unless you use 8-digit hex elsewhere.
Does the RGB to HEX tool accept bare numbers without the rgb() wrapper?
It does. A comma-separated triple such as 214, 40, 40 is understood, which is handy when a teammate pastes raw slider values from a design tool into chat and you just need the code.
Why is the hex output in uppercase letters?
The tool prints codes like #1877F2 in uppercase for readability, but case carries no meaning in CSS. Browsers treat #1877f2 and #1877F2 identically, so match whatever convention your codebase already follows.
Is converting an rgb color to hex code ever lossy?
No. Both notations describe the same 8 bits per channel, so the mapping is exact in both directions. Loss only enters the picture with formats that round, like HSL with whole-number percentages.
What happens if one of my RGB numbers is above 255?
Values outside the 0 to 255 range can't represent a real sRGB channel, so the input either fails to parse or gets clamped. If your swatch looks wrong, check for a typo like 2550 before blaming the math.
Can I convert rgb to hex online without installing anything?
That's the point of this page. Everything runs in your browser tab with no signup, no upload, and no extension. It works the same on a phone, which helps when someone sends channel values while you're away from your desk.

More Color tools

View all