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.

1Enter the three channels

Type the red, green and blue values, each a whole number from 0 to 255, in the three fields.

2Check the preview

Compare the swatch with the colour you meant; a channel that looks wrong is usually a single mistyped digit.

3Copy the hex code

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.

Two digits, always

Every channel is written as exactly two hex digits, with a leading zero where needed, so 5 becomes 05 and never breaks the code.

Full 6-digit output

The tool always returns the long form #RRGGBB, which works everywhere, even where shorthand is not supported.

Case does not matter

Uppercase and lowercase hex mean the same colour in CSS, so #3b82f6 and #3B82F6 are interchangeable.

No rounding, no drift

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.