hex2dec.com

Hex to RGB Color Converter

Convert between hex color codes and RGB values. Live preview with HSL output. Supports both 3-digit and 6-digit hex formats.

Hex to RGB

Enter a hex color code to convert to RGB

rgb(255, 87, 51)
R 255
G 87
B 51

RGB to Hex

Enter RGB values to convert to hex color

Hex: #FF5733
HSL: hsl(11, 100%, 60%)

Common Hex to RGB Color Codes

Red

#FF0000

rgb(255, 0, 0)

Green

#00FF00

rgb(0, 255, 0)

Blue

#0000FF

rgb(0, 0, 255)

White

#FFFFFF

rgb(255, 255, 255)

Black

#000000

rgb(0, 0, 0)

Yellow

#FFFF00

rgb(255, 255, 0)

Cyan

#00FFFF

rgb(0, 255, 255)

Magenta

#FF00FF

rgb(255, 0, 255)

Orange

#FFA500

rgb(255, 165, 0)

Purple

#800080

rgb(128, 0, 128)

Pink

#FFC0CB

rgb(255, 192, 203)

Gray

#808080

rgb(128, 128, 128)

How to Convert Hex to RGB

  1. 1Take the 6-character hex code (e.g., FF5733), ignoring the # prefix.
  2. 2Split into three 2-digit pairs: FF, 57, 33.
  3. 3Convert each pair from hex to decimal: FF→255, 57→87, 33→51.
  4. 4Result: rgb(255, 87, 51)

Frequently Asked Questions

What is a hex color code?

A hex color code is a 6-digit hexadecimal number representing RGB colors. The format is #RRGGBB where RR is red, GG is green, and BB is blue. Each pair ranges from 00 to FF (0-255 in decimal).

How do I convert hex to RGB?

Split the 6-digit hex into three 2-digit pairs. Convert each pair from hex to decimal. For example, #FF5733 → FF(255), 57(87), 33(51) → rgb(255, 87, 51).

What is the difference between hex and RGB?

They represent the same color in different formats. Hex uses base-16 numbers (0-9, A-F), while RGB uses decimal numbers (0-255). Web browsers and CSS support both formats.

What is HSL?

HSL stands for Hue, Saturation, Lightness. It's an alternative way to represent colors that's more intuitive for humans. Our converter shows HSL values alongside RGB and hex.

Can I use 3-digit hex codes?

Yes! 3-digit hex codes like #F53 are shorthand for #FF5533. Each digit is doubled. Our converter handles both 3-digit and 6-digit formats.