Skip to content
Calculator Tools
CSS & Design Calculators

RGB to HEX Converter

Convert RGB colour values to hex, HSL and CSS formats, with the luminance.

Also known as rgb hex converter, color converter, rgb to hexadecimal.

Enter values

Results update as you type.

Result

Hex

#2563EB

RGB
rgb(37 99 235)
HSL
hsl(221.2 83.2% 53.3%)
Hex with alpha
#2563EB
Relative luminance
0.15315
Best text colour on it
White
Short hex
Not reducible to 3 digits

About the RGB to HEX Converter

Convert RGB colour values to hex, HSL and CSS formats, with the luminance.

Also known as: rgb hex converter, color converter, rgb to hexadecimal, colour code converter.

How to use this calculator

  1. Enter red, green, blue, alpha.
  2. The result updates instantly as you type — press Calculate (or Enter) at any time.
  3. Review the breakdown shown under the main result.
  4. Use Copy result or Share to save the answer or send a link with your inputs.

RGB to HEX Converter formula

Each channel is written as two hexadecimal digits, 00 to FF

Worked example

Using the values pre-filled in the calculator above:

  • Red = 37
  • Green = 99
  • Blue = 235
  • Alpha = 1

the calculator returns:

  • Hex: #2563EB
  • RGB: rgb(37 99 235)
  • HSL: hsl(221.2 83.2% 53.3%)
  • Hex with alpha: #2563EB