RGB to Hex

Set red, green, and blue channels and get the matching #RRGGBB hex code instantly.

#808080

From channels to hex

Given `rgb(59, 130, 246)`, convert each channel to two hexadecimal digits: 59 → `3B`, 130 → `82`, 246 → `F6`. The hex code is `#3B82F6`.

Channels must stay within 0–255 for 8-bit sRGB. Out-of-range values are clamped or rejected depending on your tool; this converter expects integers in the standard range.

Leading zeros matter in hex notation: channel value 5 becomes `05`, not `5`, so the final code always has six digits after the hash.

When to convert

Design handoffs often arrive as RGB from Photoshop or Sketch; web implementations frequently prefer hex or OKLCH.

Debugging: browser devtools may show computed RGB while your source file uses hex—converting helps compare values across tools.

Pair this converter with the hex-to-RGB page to round-trip values while building palettes.