csvjson

Color Converter

Convert between HEX, RGB, and HSL color formats instantly. Use the visual color picker or type any format directly — all three update in sync.

Color format reference

HEX
#3b82f6

6 hexadecimal digits (00–FF) for each of red, green, and blue. The standard format in CSS, design tools, and brand guidelines. 3-digit shorthand (#36f) expands to 6.

Best for: CSS stylesheets, HTML color attributes, design tokens, brand color specs.

RGB
rgb(59, 130, 246)

Three integers (0–255) for red, green, and blue channels. Direct mapping to display hardware. Also supports rgba() with a 4th alpha channel (0–1) for transparency.

Best for: CSS with opacity (rgba), canvas drawing, image processing, color blending calculations.

HSL
hsl(217, 91%, 60%)

Hue (0–360°), Saturation (0–100%), and Lightness (0–100%). Intuitive for humans — creating lighter or darker variants is as simple as adjusting the L value.

Best for: CSS themes, generating color palettes, creating tints and shades programmatically.

HSL — the developer-friendly format

Why HSL is the best format for generating color palettes

Base
hsl(217, 91%, 60%)#3b82f6
Light
hsl(217, 91%, 75%)#93c5fd
Dark
hsl(217, 91%, 40%)#1d4ed8
Muted
hsl(217, 30%, 60%)#7fa3cc

Only the L (lightness) or S (saturation) value changes between variants. With HEX or RGB, you'd need to recalculate all three channels.

Frequently asked questions

What is the difference between HEX, RGB, and HSL?

All three represent the same set of displayable colors — they're just different notations. HEX (#3b82f6) is compact and common in code. RGB (59, 130, 246) maps directly to display hardware channels. HSL (217, 91%, 60%) is the most human-intuitive — you can mentally adjust hue, saturation, and lightness independently. The conversion between them is lossless (for colors in the sRGB gamut).

Why use HSL over HEX or RGB?

HSL is the best format for generating color variations programmatically. To make a color 20% lighter, just increase the L value by 20. To create a muted version, decrease S. With HEX or RGB, the same operation requires math across all three channels. CSS custom properties and color-mix() also work naturally with HSL.

What does the # sign mean in HEX colors?

It's a prefix that tells CSS the following string is a hex color value. Without it, the browser wouldn't know whether '3b82f6' is a color or some other identifier. The # itself is not part of the color code — the actual hex value is the 6 (or 3) characters that follow.

How do I add transparency to a color?

Use rgba() or hsla() — the 4th value is alpha (0 = fully transparent, 1 = fully opaque). Example: rgba(59, 130, 246, 0.5) is the blue at 50% opacity. In modern CSS you can also use hex with alpha: #3b82f680 (the last two hex digits are the alpha channel).

What is the color gamut limitation of HEX/RGB/HSL?

HEX, RGB, and HSL all operate within the sRGB color space, which covers about 35% of visible colors. Modern displays support wider gamuts (P3, Rec. 2020). CSS Color Level 4 introduces display-p3 and oklch() for wide-gamut colors. For most web work, sRGB (HEX/RGB/HSL) is sufficient and universally supported.