hex2dec.com

Hex to RGB Color Converter

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

Hex to RGB Converter

Enter a hex color code to convert to RGB, HSL, and CSS

HEX#FF5733
RGBrgb(255, 87, 51)
HSLhsl(11, 100%, 60%)
CSSrgb(255, 87, 51)
R 255
G 87
B 51

Color Shades

#000000
#33110A
#662314
#99341F
#CC4629
#FF5733
#FF795C
#FF9A85
#FFBCAD
#FFDDD6
#FFFFFF

Color Harmony

Complementary

#FF5733
#33DAFF

Analogous

#FF3374
#FF5733
#FFBE33

Triadic

#FF5733
#33FF58
#5833FF

Split Complementary

#FF5733
#33FFBE
#3374FF

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)

CSS Named Colors Reference

Browse and search all standard CSS named colors. Click any color to copy its hex value.

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. Hue is a degree on the color wheel (0-360), saturation is a percentage, and lightness is a percentage. 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.

How do I convert hex to HSL?

First convert hex to RGB by splitting into three pairs and converting each from hex to decimal. Then convert RGB to HSL using the standard formula: normalize R, G, B to 0-1, find max and min, calculate lightness as their average, then compute hue and saturation based on which channel is max. Our tool does this automatically.

What is the difference between HEX and HSL?

HEX encodes the raw red, green, and blue channel values as hexadecimal digits. HSL describes colors using hue (angle on the color wheel), saturation (intensity), and lightness (brightness). HSL is often more intuitive for designers because you can independently adjust lightness without changing the hue.

What colors are accessible for WCAG?

WCAG accessibility depends on contrast ratio between text and background. For normal text (under 18pt), you need a contrast ratio of at least 4.5:1. For large text, 3:1 suffices. Generally, dark text on light backgrounds (or vice versa) works best. Use our converter to find hex values and test combinations — for example, #000000 on #FFFFFF has a ratio of 21:1 (maximum).