Color Converter

Convert any color between HEX, RGB, and HSL with exact math and a live swatch. Pick a color, paste a code, or type RGB — free and instant.

Convert any color between HEX, RGB, and HSL with exact, standards-correct math — no rounding shortcuts. Paste a code, type rgb() or hsl(), or use the native picker, and all three formats plus a live swatch update together.

How to use Color Converter

  1. Paste or pick a color — the swatch confirms what was understood.
  2. Read HEX, RGB, and HSL rows.
  3. Copy the format your stylesheet or design tool needs.

Who it is for

Frontend developers translating design tokens, designers matching brand colors across systems, and anyone who received a color in the wrong format and needs the exact same color in another.

How it works

  • RGB to HSL uses the W3C algorithm with the result rounded to whole degrees and percents — the same numbers every converter should produce.
  • Input accepts 3- or 6-digit hex (with or without #), rgb()/rgba(), and hsl()/hsla() strings.
  • Each format has its own one-click copy button next to the value.

What it cannot do

  • It converts between formats — it does not suggest palettes or check contrast (those are the palette and contrast tools).
  • Alpha channels are parsed but the conversion output focuses on the 6-digit hex equivalent.

Sample input & output

You give

HEX: #5B4BFF

Color Converter returns

RGB: rgb(91, 75, 255) | HSL: hsl(245, 100%, 65%) — instant bidirectional sRGB conversion with live colour swatch.

Frequently asked questions

Why does my HSL say hsl(24, 100%, 50%) for #FF6600?

Because that is the exact conversion: maximum red at half luminance is 24 degrees on the color wheel. The math follows the W3C definition, not a shortcut.

Does it support 8-digit hex with transparency?

It parses the RGB part correctly; the alpha digit is accepted but the output focuses on the solid 6-digit form.

Which format should I use in CSS?

Whichever your team reads fastest — they are the same color. HSL is easiest to tweak (spin hue, adjust lightness), hex is the most common hand-off format.

How is HSL lightness different from perceived human brightness?

Standard CSS HSL computes Lightness purely as L = (max(R,G,B) + min(R,G,B)) ÷ 2 in gamma-encoded sRGB. Because human cone cells are far more sensitive to green than blue, pure yellow (#FFFF00) and pure blue (#0000FF) both report 50% HSL lightness even though yellow has a WCAG relative luminance of 0.93 versus 0.07 for blue. Always verify text legibility in Contrast Checker.

Does converting from RGB to HSL and back introduce rounding drift?

Integer-rounded HSL strings (such as hsl(245, 100%, 65%)) quantize hue to 360 steps and saturation/lightness to 101 steps each — roughly 3.6 million combinations versus 16,777,216 exact 24-bit HEX/RGB colours. Keep 6-digit HEX or integer RGB as your canonical design-system source of truth when exact byte parity matters.

How do 3-digit shorthand HEX codes like #F60 expand to 6-digit HEX?

Under the CSS Color Module specification, each hexadecimal nibble in #RGB duplicates itself rather than padding with zero: #F60 expands to #FF6600 (rgb(255, 102, 0)), NOT #F06000. Conversely, a 6-digit HEX colour can only be shortened to 3 digits when all three R, G, and B byte pairs consist of identical twin hex digits.

Which CSS colour format should I paste into modern stylesheets?

All modern browsers render #RRGGBB, rgb(r g b), and hsl(h s% l%) identically inside the standard sRGB gamut. Use HEX for compact static tokens, RGB when pairing with alpha channels or canvas pixel buffers, and HSL when building hover/active lightness ramps or dark-mode theme variables in CSS.