RGB to Hex Color

0–255
0–255
0–255

Convert RGB color values to a CSS hex code.

Formula

hex = '#' + toHex(R) + toHex(G) + toHex(B)
  • toHex(n) = n.toString(16).padStart(2,'0').toUpperCase()

RGB to Hex Color Example

Inputs
  • Red: 52 0–255
  • Green: 152 0–255
  • Blue: 219 0–255

rgb(52,152,219) → #3498DB

Frequently asked questions

How do I use the RGB to Hex Color?
Enter the value in the input field and the result updates immediately.
How accurate is this converter?
Uses internationally recognised conversion factors. Results are rounded to the displayed decimal places.
Can I verify this manually?
Yes — apply the formula shown above step by step.