Skip to content
Convert

RGB to Hex

Convert RGB to Hex in one step. Paste your values and get instant results—see the same color in all formats.

to

Enter RGB value

?
R
G
B
Converts to Hex
Fill in the RGB values above to see the result

Conversion guide

RGB to Hex — How it works

How RGB to Hex conversion works

RGB (Red, Green, Blue) values are integers from 0 to 255 per channel. Hex codes encode the same three values in base-16: each channel is converted to a two-digit hexadecimal number (00FF), then concatenated with a # prefix.

Formula

For each channel, divide by 16 to get the first hex digit, then take the remainder for the second:
hex = # + toHex(R) + toHex(G) + toHex(B)
where toHex(n) gives two hex digits for n in 0–255 (e.g. 255 → FF, 26 → 1A).

Example: RGB(255, 0, 128) → Red=FF, Green=00, Blue=80 → #FF0080 (pink). RGB(26, 43, 60) → #1A2B3C.