Color Converter — HEX, RGB & HSL

Free online color converter. Convert between HEX, RGB, and HSL color codes instantly with a live color preview. Essential for web design, CSS, and graphic design. Accurate, instant, no sign-up.

🎨

Color Converter

HEX ↔ RGB ↔ HSL • live preview

#
R
G
B
HEX
#2563EB
RGB
rgb(37, 99, 235)
HSL
hsl(221, 83%, 53%)
CSS
#2563EB

How to Use the Color Converter

  1. Enter a HEX code — type 6 hex digits (e.g. 2563EB) and RGB, HSL, and the preview update live.
  2. Or enter RGB — set Red, Green, Blue (0–255) and the HEX/HSL update automatically.
  3. Use the color picker — click the swatch picker to choose visually; all codes sync.
  4. Copy any format — grab the HEX, RGB, or HSL string for your CSS or design tool.

Benefits

💻

Web & CSS

Convert design HEX codes to RGB/RGBA for transparency, or HSL for easy lightness and saturation tweaks in CSS.

🖌️

Graphic Design

Match brand colors across tools — Figma, Photoshop, and Illustrator each prefer different formats.

🎛️

HSL Control

HSL (hue, saturation, lightness) makes it intuitive to create tints, shades, and color variations programmatically.

Color Code Guide — HEX, RGB, and HSL Explained

Digital colors are described in three common formats. HEX (hexadecimal) is the web standard: a 6-digit code like #2563EB, where the pairs represent Red, Green, and Blue from 00 to FF (0–255 in decimal). RGB expresses the same values as decimals — rgb(37, 99, 235) — which is handy when you need an alpha channel (RGBA) for transparency. Both describe identical colors; HEX is just a compact way of writing RGB. Converting between them is constant work for web developers and designers.

HSL (Hue, Saturation, Lightness) takes a different, more human approach: hue is an angle on the color wheel (0–360°), saturation is color intensity (0–100%), and lightness runs from black to white (0–100%). HSL makes it easy to generate a palette — keep the hue and adjust lightness for tints and shades, or rotate the hue for complementary colors. Modern CSS supports all three formats, so converting accurately between HEX, RGB, and HSL lets you pick the most convenient representation for each task, whether matching a brand color, building a design system, or fine-tuning a gradient.

#

HEX Format

#RRGGBB — two hex digits each for red, green, blue. #FF0000 = pure red, #00FF00 = green, #0000FF = blue, #FFFFFF = white, #000000 = black.

🎚️

RGB Format

rgb(r, g, b) with each 0–255. rgb(255,0,0) = red. Add alpha for transparency: rgba(255,0,0,0.5) = 50% transparent red.

🌈

HSL Format

hsl(hue, sat%, light%). Hue 0/360 = red, 120 = green, 240 = blue. Lightness 0% = black, 50% = pure color, 100% = white.

🎯

Common Colors

Red #FF0000. Blue #0000FF. Green #008000. Black #000000. White #FFFFFF. Gray #808080. Orange #FFA500.

Formula & Logic

Digital colour has several representations describing the same thing for different purposes. RGB and its hex shorthand are how displays actually work, mixing red, green and blue light in 256 levels each — 16.7 million combinations. HSL restructures the same information into hue, saturation and lightness, which maps far better onto how people reason about colour: making something "lighter" is one number in HSL and three coordinated changes in RGB. That is why design systems are usually built in HSL and rendered in hex. CMYK is a different beast entirely — subtractive ink rather than additive light — and cannot reproduce many RGB colours at all.

Hex = RGB values written as two hexadecimal digits eachL = (max + min) ÷ 2, where max/min are the largest and smallest of R,G,B ÷ 255S = (max − min) ÷ (1 − |2L − 1|)H = 60° × the offset of the dominant channel

where:

R, G, B
0–255 each, or 0–1 normalised for the HSL maths
H
hue in degrees around a colour wheel, 0–360
S
saturation, 0% grey to 100% fully saturated
L
lightness, 0% black to 100% white; 50% is the pure hue

Assumptions: sRGB colour space, the web default. Wide-gamut displays and print (CMYK) cover different ranges, so a colour that renders correctly on screen may be out of gamut for a printer.

Step-by-Step Example: Converting rgb(52, 152, 219) to Hex and HSL

Take a common interface blue through both conversions.

  • RGB52, 152, 219
  1. To hex, convert each channel: 52 = 34, 152 = 98, 219 = DB.
  2. Concatenate with a hash: #3498DB.
  3. For HSL, normalise: R = 0.204, G = 0.596, B = 0.859.
  4. Lightness: (0.859 + 0.204) ÷ 2 = 0.531, so L = 53.1%.
  5. Saturation: (0.859 − 0.204) ÷ (1 − |2(0.531) − 1|) = 0.655 ÷ 0.937 = 0.699, so S = 69.9%.
  6. Hue: blue is the dominant channel, giving H = 204.1°.

Resultrgb(52,152,219) = #3498DB = hsl(204, 70%, 53%)

The HSL form is the useful one for building a palette: holding hue and saturation while varying lightness from 20% to 90% produces a coherent tonal ramp of the same colour, which is extremely awkward to generate by adjusting RGB values directly.

Color Conversion FAQ

Split the 6-digit HEX code into three pairs and convert each from hexadecimal to decimal (0–255). For #2563EB: 25₁₆ = 37, 63₁₆ = 99, EB₁₆ = 235, giving rgb(37, 99, 235). This converter does it instantly — just type the HEX code and the RGB values appear.
RGB defines a color by mixing red, green, and blue light (0–255 each), which maps to how screens emit light but isn't intuitive for humans. HSL defines the same color by hue (which color), saturation (how vivid), and lightness (how bright). HSL is easier for design tasks like making a color lighter or finding complementary hues, while RGB/HEX are the storage standard.
The hash symbol (#) signals that the following characters are a hexadecimal color code in CSS and HTML. #FF5733 tells the browser to interpret FF5733 as a hex color. It's required in CSS (color: #FF5733) but this converter accepts the code with or without it.
Yes — RGBA is just RGB plus an alpha (opacity) value from 0 (transparent) to 1 (opaque). Convert your HEX to RGB here, then add the alpha: rgb(37, 99, 235) becomes rgba(37, 99, 235, 0.5) for 50% opacity. The RGB numbers stay the same; only the alpha controls transparency.

Related Tools

✔ Written & reviewed by Dr Sam — 20+ yrs in management & research leadership📅 Last updated June 2026📚 Sources: CIE colour spaces & ICC profile specifications📑 How we build & check these