Enter red, green and blue values from 0–255 and get the matching hex colour code straight away, with a live swatch you can copy into CSS, SVG, or any design tool.
How it works
A hex colour code packs the three RGB channels into a base-16 string. The converter takes each channel value (0–255), converts it to a two-digit hexadecimal number, and joins the three pairs in red-green-blue order, prefixed with #. Values outside 0–255 are clamped. Because one hex digit covers 0–15, two digits cover the full 0–255 range of a channel, so the result is always #rrggbb.
Example
Convert rgb(59, 130, 246):
- 59 →
3b - 130 →
82 - 246 →
f6 - Result:
#3b82f6
| RGB | Hex |
|---|---|
| rgb(0, 0, 0) | #000000 |
| rgb(255, 255, 255) | #ffffff |
| rgb(255, 0, 0) | #ff0000 |
| rgb(59, 130, 246) | #3b82f6 |
It all runs in your browser — nothing is uploaded.