EasyUnitConverter.com

HEX to RGB Color Converter

Enter the hex color code to convert to RGB or RGB to Hex.

#FF5733

What does this Hex to RGB converter do?

It takes a hexadecimal color code (like #FF5733) and converts it to its RGB equivalent — three separate values for Red, Green, and Blue channels, each ranging from 0 to 255. This is useful when you need to use a hex color in software that requires RGB input, or when you want to understand the color composition.

How to Convert Hex to RGB

  1. Get the 2 left digits of the hex color code and convert to decimal — this is the Red value
  2. Get the 2 middle digits and convert to decimal — this is the Green value
  3. Get the 2 right digits and convert to decimal — this is the Blue value

Formula

R = parseInt(hex[0..1], 16)

G = parseInt(hex[2..3], 16)

B = parseInt(hex[4..5], 16)

Example

Hex: #FF5733

R = FF₁₆ = 15×16 + 15 = 255

G = 57₁₆ = 5×16 + 7 = 87

B = 33₁₆ = 3×16 + 3 = 51

Result: rgb(255, 87, 51)

Hex to RGB Color Table

ColorHexRGBPreview
Black#000000000
White#FFFFFF255255255
Red#FF000025500
Lime#00FF0002550
Blue#0000FF00255
Yellow#FFFF002552550
Cyan#00FFFF0255255
Magenta#FF00FF2550255
Orange#FFA5002551650
Coral#FF7F5025512780
Tomato#FF63472559971
Gold#FFD7002552150
Silver#C0C0C0192192192
Gray#808080128128128
Maroon#80000012800
Navy#00008000128

Technical Details

Hex color codes use 24-bit color (8 bits per channel). The format is #RRGGBB where each pair represents a value from 00 to FF (0-255 in decimal). CSS also supports shorthand #RGB notation where each digit is doubled (#F00 = #FF0000). Modern CSS additionally supports rgba() for transparency and hsl() for hue-saturation-lightness color models.

Frequently Asked Questions

How do I convert a hex color code to RGB?

Split the 6-digit hex code into three pairs (RR, GG, BB) and convert each pair from hexadecimal to decimal. For example, #FF5733 becomes R=255, G=87, B=51.

What is the difference between hex and RGB color formats?

Both represent the same colors. Hex uses a compact 6-character string (#FF5733), while RGB uses three decimal numbers (255, 87, 51). Hex is common in CSS and design tools; RGB is used in programming and image editing.

What does #000000 mean in RGB?

#000000 is black — all three channels (red, green, blue) are at zero. Conversely, #FFFFFF is white with all channels at maximum (255, 255, 255).

Can I use shorthand hex codes like #F00?

Yes. In CSS, 3-digit hex codes are expanded by doubling each digit. So #F00 becomes #FF0000 (pure red), and #09C becomes #0099CC.

Why do designers use hex colors instead of RGB?

Hex codes are shorter to type in CSS and easier to copy/paste. They also make it simple to identify color relationships — similar hex values produce similar colors.

Related Converters: