Irodori彩り

RGB to HEX

HEX · RGB · HSL · OKLCH · Lab · CMYK

RGB to HEX

Every color format describes the same thing in a different language: HEX for stylesheets, RGB for screens and code, HSL for building palettes, CMYK for print. Pick the conversion you need and get the exact value, a live preview and the formula behind it.

This color in every format

The same color written as HEX, RGB, HSL and CMYK. Copy any value.

RGB to HEX conversion

Every conversion first normalises RGB into an sRGB triplet — red, green and blue on a 0–255 scale — and then encodes that triplet as HEX. Both notations describe the same pixel, so the visible color does not change.

1

Read the input

Split the RGB value into its channels (hex digit pairs, numbers or percentages).

2

Normalise to sRGB

Scale each channel onto 0–255 so rounding differences do not accumulate.

3

Encode HEX

Write the result in HEX notation and copy it into your stylesheet or design tool.

Formula

rgb(255, 87, 51)
→ sRGB  rgb(255,87,51)
→ HEX  #FF5733

Worked example

rgb(255, 87, 51) = #FF5733 = #FF5733

Values are rounded to whole channels; convert back with the same tool to avoid drift.

RGB to HEX reference table

Common values converted with the same formula.

Input (RGB)Result (HEX)
rgb(255,87,51)#FF5733
rgb(79,70,229)#4F46E5
rgb(46,204,113)#2ECC71
rgb(52,152,219)#3498DB
rgb(231,76,60)#E74C3C
rgb(25,174,153)#19AE99
rgb(155,89,182)#9B59B6
rgb(243,156,18)#F39C12
rgb(52,73,94)#34495E
rgb(233,31,99)#E91F63
rgb(0,0,0)#000000
rgb(255,255,255)#FFFFFF

All converters

Frequently asked questions

Does converting RGB to HEX change the color?
No. Both formats describe the same sRGB color; only the notation changes.
Why do my HEX values differ from another converter?
Rounding. Other tools may round at a different step or use a different white point; ours follows CSS Color 4 and D65.
Can I paste the HEX value into CSS?
Yes. HEX is native CSS or a widely supported notation, so it works in stylesheets, canvas and design tools.
Which format should I use for print?
Use CMYK for print and RGB/HEX for screens. CMYK is an approximation, so convert the final artwork with your printer profile.