HomeToolsColor Converter
All Tools

Color Converter - HEX, RGB, HSL

Color Converter

Convert between HEX, RGB, and HSL color formats

#3B82F6
R
G
B
H
S%
L%

CSS Values

HEX:#3B82F6
RGB:rgb(59, 130, 246)
RGBA:rgba(59, 130, 246, 1)
HSL:hsl(217, 91%, 60%)

Color Shades

100
200
300
400
500
600
700
800
900
1000
Click any shade to copy its HEX value

Conversion Formulas

HEX to RGB
R = parseInt(hex[1-2], 16)
G = parseInt(hex[3-4], 16)
B = parseInt(hex[5-6], 16)
RGB to HEX
hex = '#' + R.toString(16) + G.toString(16) + B.toString(16)

How do you convert between HEX, RGB, and HSL color formats?

HEX, RGB, and HSL are three common ways to represent colors in web development. HEX uses a 6-digit hexadecimal notation (#RRGGBB) where each pair represents red, green, and blue intensity from 00 to FF. RGB specifies color as three decimal values from 0-255: rgb(255, 128, 0) is orange. HSL uses Hue (0-360°, the color wheel position), Saturation (0-100%, color intensity), and Lightness (0-100%, brightness). To convert HEX to RGB, parse each pair as a base-16 number. To convert RGB to HSL, normalize R,G,B to 0-1, find max and min values to compute lightness, then calculate saturation and hue from the channel differences. HSL is often preferred for design because adjusting lightness or saturation is intuitive — you can create consistent color palettes by keeping hue constant while varying saturation and lightness.

Built with care by Alpiaal