Color Converter
Convert between HEX, RGB, HSL, HSB and CMYK with a live preview.
Updated · Examples checked by automated tests
| HEX | #6366f1 | |
| RGB | rgb(99, 102, 241) | |
| RGBA | rgba(99, 102, 241, 1) | |
| HSL | hsl(239, 84%, 67%) | |
| HSLA | hsla(239, 84%, 67%, 1) | |
| HSB | hsb(239, 59%, 95%) | |
| CMYK | cmyk(59%, 58%, 0%, 5%) | |
| CSS var | --color: #6366f1; |
Tints and shades
About Color Converter
Every colour on screen can be written several ways, and each notation suits a different job: hex for CSS, RGB for canvas work, HSL for building tints and shades programmatically.
This converter keeps every representation in sync as you adjust any one of them, with a live swatch, an eyedropper where the browser supports it, and copy buttons on each format.
How Color Converter works in your browser
Conversions are computed directly from the colour space definitions rather than looked up. HEX to RGB is a base-16 parse; RGB to HSL finds the maximum and minimum channel values and derives hue, saturation and lightness from their relationship. Every conversion is exact and reversible, so round-tripping a colour returns the value you started with.
HSL is included because it is the space that matches how people describe colour changes. "Slightly darker" is a single lightness adjustment in HSL, but requires changing all three channels in RGB, usually by unequal amounts.
Alpha is carried through every format that supports it — eight-digit hex, rgba() and hsla() — so transparency survives conversion instead of being silently dropped.
When to use it
- Converting a hex value from a design file into the hsl() form a CSS variable system uses.
- Producing a lighter or darker variant of a brand colour by changing lightness alone.
- Translating a colour from a style guide into the format a particular framework expects.
- Reading the exact value behind a colour you have been given in an unfamiliar notation.
Worked examples
Convert a brand HEX colour for CSS and print
Settings: Default
Input
#6366f1Expected output
HEX: #6366f1
RGB: rgb(99, 102, 241)
RGBA: rgba(99, 102, 241, 1)
HSL: hsl(239, 84%, 67%)
HSLA: hsla(239, 84%, 67%, 1)
HSB: hsb(239, 59%, 95%)
CMYK: cmyk(59%, 58%, 0%, 5%)HSL is usually the easiest form to adjust in CSS: change only the last number to make a lighter or darker shade of the same hue.
Keep transparency when converting
Settings: Default
Input
rgba(255, 0, 0, 0.5)Expected output
HEX: #ff000080
RGB: rgb(255, 0, 0)
RGBA: rgba(255, 0, 0, 0.5)
HSL: hsl(0, 100%, 50%)
HSLA: hsla(0, 100%, 50%, 0.5)
HSB: hsb(0, 100%, 100%)
CMYK: cmyk(0%, 100%, 100%, 0%)Alpha is carried into the 8-digit HEX form and into RGBA and HSLA. The plain RGB and HSL rows drop it, as those CSS forms have no alpha.
Limits and checks before you use the result
- CMYK is calculated with a simple formula that ignores ink and paper profiles. Use it as a starting point and ask your printer for exact values.
- HSL and HSB values are rounded to whole numbers, so converting back can shift a HEX value by one step.
- Wide-gamut CSS colours such as oklch() and display-p3 are not supported.
Frequently asked questions
How do I convert HEX to RGB?
Each pair of hex digits is one channel in base 16. #FF8800 is red 255, green 136, blue 0. The conversion is exact and reversible.
What is HSL used for?
It matches how people describe colour changes. Making something slightly darker is one lightness adjustment in HSL, but requires changing all three RGB channels by unequal amounts.
What is the difference between HSL and HSB?
Both use hue and saturation, but HSL varies lightness towards white and black, while HSB varies brightness towards black only. Design tools usually show HSB.
Is CMYK accurate for print?
The conversion here is the standard naive formula. Real print work needs an ICC profile for the specific press and paper.
Does it support alpha?
Yes. Set an alpha value and the RGBA, HSLA and eight-digit hex forms are all produced.
Related tools
Color Contrast Checker
Check text contrast against WCAG AA and AAA accessibility levels.
Percentage Calculator
Work out percentages, shares and percentage change in one place.
EMI Calculator
Calculate loan EMI, total interest and a full amortisation schedule.
GST Calculator
Add or remove GST at any rate and see the CGST/SGST split.
SIP Calculator
Project the maturity value of a monthly systematic investment plan.
Compound Interest Calculator
See how an investment grows with compounding and regular contributions.