Convert RGB to HEX Online — Free
Runs 100% in your browser — your files never leave your device.
Design tools and color pickers hand you rgb() values; stylesheets and most UIs want HEX. Paste an rgb() value and read the same color as a HEX code — and hsl() — normalized and ready to copy. The conversion runs entirely in your browser.
How it works
- 1
Paste an RGB color
Enter a value like rgb(51, 102, 153).
- 2
Read the HEX value
The same color appears as HEX and hsl() at once.
- 3
Copy what you need
One click copies any format to your clipboard.
About this tool
How the conversion works
The tool takes your three decimal channel values — red, green, blue from 0 to 255 — and encodes each as two hexadecimal digits, joined into the compact HEX form. The conversion is exact: same color, compressed notation.
When to reach for it
Design systems and style guides standardize on HEX, and most CSS is cleaner as HEX. When a color comes from a screenshot picker or a library API as RGB numbers, this is the last step before it enters the codebase.
Reading HEX comfortably
The six digits are three pairs: red, green, blue. 00 is none of a channel, ff is full. Grayscale HEX values have three identical pairs (#333, #999), which makes spotting true grays — and fake ones — instant.
Frequently asked questions
What range do the RGB inputs accept?
Each channel accepts 0 through 255, the full range a display can render. Values outside the range clamp to the nearest bound.
Why is HEX preferred in CSS?
Tradition and terseness — six characters name any color exactly, and every tool reads them. Functionally HEX and rgb() are interchangeable; consistency within a codebase matters more than the choice.
Can I convert RGB with alpha to HEX?
Yes — the alpha channel converts to the optional trailing pair (#RRGGBBAA). Keep in mind many older tools ignore the eighth digit.