RGB to HEX Converter

Convert RGB color values to HEX codes instantly. Our free RGB to HEX converter features intuitive sliders and live preview for perfect color matching.

Easy Sliders
Copy HEX Code
Live Preview

RGB to HEX Color Converter

Adjust the RGB sliders or enter values to convert to HEX

99
102
241
Color Preview

RGB to HEX Conversion Results

HEX
#6366F1
RGB
rgb(99, 102, 241)
CSS HEX
color: #6366F1;
Background
background: #6366F1;
Copied to clipboard!

How RGB to HEX Conversion Works

Understanding RGB Values

RGB (Red, Green, Blue) uses three values from 0-255 to define any color. 0 means no light, 255 means maximum intensity. Our RGB to HEX converter transforms these decimal values into hexadecimal format.

The Conversion Formula

RGB to HEX conversion converts each decimal value (0-255) to a two-digit hexadecimal number (00-FF):

HEX = R.toString(16) + G.toString(16) + B.toString(16)

Our RGB to HEX converter handles this automatically with proper padding.

Why Convert RGB to HEX?

HEX codes are shorter and widely used in CSS stylesheets. Use our RGB to HEX converter when:

  • Writing compact CSS code
  • Matching design specifications
  • Sharing colors in documentation

RGB to HEX Examples

Common conversions using our RGB to HEX converter:

  • rgb(255, 255, 255) → #FFFFFF - White
  • rgb(0, 0, 0) → #000000 - Black
  • rgb(255, 0, 0) → #FF0000 - Red
  • rgb(0, 128, 0) → #008000 - Green