Have three RGB numbers from code, a screenshot tool or a design app and need the short hex code for a stylesheet? This free rgb to hex converter turns rgb(59, 130, 246) into #3B82F6, with a preview swatch so a mistyped channel is obvious before you use the result. Everything runs in your browser, so nothing is uploaded and no signup is needed.
How to use this rgb to hex converter
Three quick steps — enter, check, copy.
Type the red, green and blue values, each a whole number from 0 to 255, in the three fields.
Compare the swatch with the colour you meant; a channel that looks wrong is usually a single mistyped digit.
Copy the 6-digit code, for example #3B82F6, into your CSS or brand document.
What makes this rgb to hex converter safe to paste from
Built to be free, private, and exact — right in your browser.
Every channel is written as exactly two hex digits, with a leading zero where needed, so 5 becomes 05 and never breaks the code.
The tool always returns the long form #RRGGBB, which works everywhere, even where shorthand is not supported.
Uppercase and lowercase hex mean the same colour in CSS, so #3b82f6 and #3B82F6 are interchangeable.
RGB to hex is a base change, not an approximation, so converting back returns the exact numbers you started with.
RGB to HEX Converter FAQs
Short, direct answers to the questions readers ask most.
Write each channel as a two-digit base-16 number and join them after a #: 59 becomes 3B, 130 becomes 82 and 246 becomes F6, giving #3B82F6.
Only when each channel pair repeats, such as #FF0000 shortening to #F00; the tool returns the full form because it is always safe.
The tool rejects it. Each RGB channel runs from 0 to 255, and a larger number is not a valid channel.
No. In CSS and HTML, #FF0000, #ff0000 and #Ff0000 all describe the same colour.
Hex is shorter, has no spaces or commas to mistype, and is the format most stylesheets and design tools expect.
Related Tools
More free converters that work the same way — right in your browser.
Free image color picker that picks any colour from a photo online, with no upload and no signup.
Photo FiltersFree photo filters that restyle your picture online, with no upload and no signup.
Image ResizerFree image resizer that changes your photo’s dimensions online, with no upload and no signup.
JPG to PNG ConverterConvert JPG images to PNG online, with no upload and no signup.
Try the related tools above, or go back to the Convertion homepage for more free converters.
