Color Converter
Design tools speak HEX, code speaks RGB, and humans adjusting a color think in HSL — lightness up, saturation down. This converter translates between the three spellings of the same color and shows a live swatch, so a value copied from a design file can be pasted into a stylesheet with confidence.
Type any of the three forms — #RRGGBB, rgb(r, g, b), or hsl(h, s%, l%) — and get all three back.
HEX
#0B7A5C
RGB
rgb(11, 122, 92)
HSL
hsl(164, 83.5%, 26.1%)
Click the swatch to pick a color visually, or type any format — both directions stay in sync. The swatch is this color on your screen; exact appearance still depends on your display, like every color tool.
Embed this calculator on your website →
The formula
lightness = (max + min) ÷ 2 · saturation = (max − min) ÷ (max + min) when lightness ≤ ½
hue = 60° × the sector formula for whichever channel is largest
- max / min — the largest and smallest of the red, green, and blue channels, each as a fraction of 255 (the standard CSS Color conversion).
- hue — the position on the color wheel, 0° (red) through 120° (green) to 240° (blue) and back; greys have no hue and report 0.
- display rules — hue is rounded half-up to whole degrees, saturation and lightness to one decimal percent, and RGB channels half-up to whole numbers. Those roundings are why converting back can move a channel by 1.
Worked example: this site's deep green #0B7A5C is rgb(11, 122, 92) and hsl(164, 83.5%, 26.1%) — the default in the tool above.
How it works
Three views of one color. HEX and RGB are the same information — HEX is just the three channels written in base 16, two digits each (0B = 11, 7A = 122, 5C = 92). HSL re-expresses those channels as a wheel position plus how vivid and how light the color is, which is why designers adjust colors in HSL: "same hue, lighter" is one number changed.
Shorthand hex. A 3-digit hex like #F00 expands by doubling each digit — #FF0000, pure red. It is a compression for colors whose channels happen to use doubled digits, not a different system.
Why the return trip can differ by 1. HSL is printed rounded (whole degrees, one decimal), and that rounding can shift a channel by one step on the way back: shift the deep green's hue by a single degree, to hsl(163, 83.5%, 26.1%), and the blue channel lands on 91 instead of 92. The HEX and RGB forms are always exact; only the rounded HSL display can lose that last step.
Examples
- #FF0000 → rgb(255, 0, 0), hsl(0, 100%, 50%) — the wheel's starting point.
- #808080 → hsl(0, 0%, 50.2%) — a pure grey: zero saturation, halfway lightness.
- hsl(210, 50%, 40%) → #336699 — the classic textbook slate blue.
- #4682B4 → hsl(207, 44%, 49%) — steel blue, named in CSS, converted by formula here.
Frequently asked questions
What is the difference between HEX and RGB?
Nothing but notation. HEX writes the same three 0–255 channels in base 16 (#0B7A5C) where RGB writes them in decimal (rgb(11, 122, 92)). Any color one can express, the other can, exactly.
Why does HSL exist if it holds the same color?
For adjustment. In HSL, making a color lighter, darker, or more vivid means changing one understandable number; in RGB the same change means moving three channels in a ratio you have to work out. Design systems routinely define a base color in HEX and derive hover and disabled states in HSL.
Does this support alpha (transparency)?
Not in this tool — it converts the three opaque forms (HEX, RGB, HSL). Eight-digit hex and rgba()/hsla() carry a fourth, alpha channel; converting them here would silently drop the transparency, so they are rejected rather than mis-converted.
Why did converting back change my color slightly?
The printed HSL is rounded — hue to whole degrees, saturation and lightness to one decimal. That rounding can shift a channel by one step on the way back (the deep green's blue channel moves 92 → 91 if the hue is taken one degree lower). The underlying conversion is the standard formula; the loss is in the display precision, and it is why the page states the rounding rules openly.
Related calculators
WCAG Contrast Checker
LiveCheck a text/background color pair against the WCAG contrast ratios — AA and AAA verdicts for normal and large text, judged on the unrounded ratio.
JSON Formatter & Validator
LiveFormat, validate, and minify JSON, with the exact position of any syntax error pointed out.
Base64 Encode / Decode
LiveEncode text to Base64 or decode Base64 back to text, with full UTF-8 support for accents and emoji.

