Hex / RGB / HSL Color Converter
Convert a color between HEX, RGB, and HSL formats, with the parsed channel values and CSS-ready strings.
Result
How to use this calculator
- Enter a color in HEX, rgb(), or hsl() format.
- Read the equivalent HEX, RGB, and HSL values.
- Use the channel breakdown to tweak individual components.
- Copy the CSS-ready string you need into your stylesheet.
About this calculator
Web colors are written in several formats, and converting between them is a constant need in design and front-end work. This converter accepts a color in HEX (#1a73e8), RGB (rgb(26, 115, 232)), or HSL (hsl(214, 82%, 51%)) and returns all three, plus the individual channel values. HEX and RGB are two ways of writing the same thing — the red, green, and blue intensities from 0 to 255 — so converting between them is a direct base-16 mapping. HSL (hue, saturation, lightness) is a cylindrical re-mapping of the RGB cube designed to be more intuitive for humans: hue is the angle on the color wheel (0–360°), saturation is how vivid the color is, and lightness is how bright. HSL is especially handy for generating variations of a color by nudging one channel. All conversions use the standard CSS Color definitions in the sRGB space.
How it works — the formula
HEX↔RGB: each pair = channel value (base 16 ↔ base 10)
RGB→HSL: L=(max+min)/2; S from chroma; H from which channel is maxHEX and RGB are equivalent integer encodings; HSL is derived from the max/min of the normalized channels.
Worked examples
- Inputs:
- color=#ff0000
- Output:
- rgb(255,0,0), hsl(0,100%,50%)
- Inputs:
- color=#1a73e8
- Output:
- rgb(26,115,232), hsl(214,82%,51%)
- Inputs:
- color=rgb(26,115,232)
- Output:
- #1a73e8
Limitations
- sRGB opaque colors; alpha not composited.
- HSL rounded to whole units for readability.
- Named colors (e.g. "tomato") not parsed — use HEX/RGB/HSL.
Standard CSS sRGB conversions.
Frequently asked
How do I convert HEX to RGB?+
What is HSL and why use it?+
Are HEX and RGB the same thing?+
Why might a color not round-trip exactly?+
Does this handle alpha/transparency?+
What color space does this use?+
Related calculators
More tools you might like
Hand-picked tools that pair well with this one — same audience, same intent.
Check the contrast ratio between a text color and background and whether it passes WCAG AA and AAA for normal and large text.
Generate a harmonious color palette — complementary, analogous, triadic, tetradic, or monochromatic — from a base color.
Convert a color between hex, RGB, HSL, HWB, and CMYK. Reports relative luminance and WCAG 2.2 contrast ratio against white and black.
Convert numbers between hexadecimal, binary, octal, and decimal. Shows the bit pattern grouped by nibble + the two’s-complement representation for negative values.
Convert between satoshis and bitcoin (1 BTC = 100,000,000 sats) and optionally value either in US dollars at a given BTC price.
Convert between 30 major world currencies using a snapshotted static rate table — clearly marked, not live.