How to use the Color Converter
- 1
Enter a colour
Use the colour picker or type a value such as #0f766e, f60, rgb(255, 153, 51) or hsl(200, 80%, 40%).
- 2
Read the table
HEX, RGB, HSL and CMYK update together; press Copy beside the row you need.
- 3
Check the sample
The “Aa” swatch shows your colour with whichever of black or white text reads better, plus both contrast ratios.
- 4
Explore variations
Click any tint or shade chip to load it as the new colour; its hex is copied at the same time.
Features
Forgiving input
Accepts 3- or 6-digit hex with or without #, rgb()/rgba() and hsl()/hsla(), including the space-separated and deg forms.
CMYK estimate
Converts with the simple device-independent formula — useful as a starting point for print, not a press-calibrated value.
WCAG grading
Rates white and black text on your colour as AAA, AA, AA large text only, or fails.
HSL-based tints
The chip row keeps hue and saturation and changes only HSL lightness.
One-click copy
Every row has its own Copy button so you paste exactly the syntax you need.
Local only
All maths runs in your browser; nothing is sent anywhere.
Who uses it — and for what
Designers
Turn a brand hex from a style guide into HSL for CSS or CMYK for a printer brief.
Developers
Convert a designer’s rgb() value into a short hex for a stylesheet.
Print shops
Get a first CMYK estimate before a proper colour-managed proof.
Accessibility reviewers
See at a glance whether white or black text is the safer choice on a brand colour.
Colour formats explained
- HEX (#4F46E5) — the compact web format: two hex digits each for red, green and blue.
- RGB — the same three channels as numbers from 0 to 255.
- HSL — hue (0–360°), saturation and lightness; easiest for making lighter or darker variants.
- CMYK — cyan, magenta, yellow and black percentages used for print. Screen-to-print conversion is approximate; ask your printer for their profile for exact matches.
Contrast for readable text
WCAG accessibility guidelines ask for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. The tool calculates the ratio of your colour against white and black text and tells you which passes. Click any tint or shade to load it and copy its value.
How each conversion is calculated
Every format here describes the same sRGB colour, so the converter always goes through RGB in the middle.
- HEX ↔ RGB is exact: each pair of hex digits is one channel from 00 to FF (0–255). Three-digit hex doubles each digit, so
f60becomesff6600. - RGB → HSL finds the largest and smallest channel. Lightness is their average, saturation is how far apart they are relative to lightness, and hue is the angle on the colour wheel decided by which channel is largest. HSL values in the table are rounded to whole numbers, so converting the rounded HSL back can land one step off the original hex — keep the hex as your master value.
- RGB → CMYK uses the textbook formula: K = 1 − (largest channel ÷ 255), then C, M and Y are what remains of each channel after removing black. Pure black gives
cmyk(0%, 0%, 0%, 100%).
That last formula ignores paper colour, ink behaviour and the printer’s colour profile. Real print workflows use ICC profiles (for example FOGRA or GRACoL standards), which can give quite different numbers for the same RGB colour. Treat the CMYK row as a rough guide and ask your printer for a proof when colour accuracy matters, especially for bright oranges, greens and blues that sit outside what CMYK inks can reproduce.
Reading the tint and shade row
The chip row is built by holding hue and saturation fixed and setting HSL lightness to 95, 85, 75, 65 and 55 percent on the left, your exact colour in the middle, then 40, 30, 22, 15 and 8 percent on the right. Because the lightness steps are fixed rather than relative to your colour, the row behaves differently depending on where your colour starts:
- For a mid-tone colour (lightness around 50–60%), the row reads cleanly from light to dark.
- For a dark colour such as
#0F766E(26% lightness), several chips to the right of the centre are actually lighter than the original, because 40% and 30% are above 26%. - For a colour at exactly 40% lightness, the first chip on the right repeats it.
So read the chips by their hex value rather than by position. If you need a strict 50–950 ramp centred on a brand colour, the CSS Variables Generator mixes toward white and black instead, which always keeps the order.
HSL lightness is also not perceptual: a yellow and a blue at 50% lightness look very different in brightness. That is why the contrast numbers, which use real luminance, matter more than the L value when choosing text colours.
Worked examples
Teal brand colour, every format
Input #0F766E:
| Format | Result |
|---|---|
| HEX | #0F766E |
| RGB | rgb(15, 118, 110) |
| HSL | hsl(175, 77%, 26%) |
| CMYK | cmyk(87%, 0%, 7%, 54%) |
Contrast line: white text 5.47:1 (AA), black text 3.84:1 (AA large text only). So white is the right text colour for buttons in this teal.
Short hex and HSL input
Typing f60 (no hash, three digits) expands to #FF6600 = rgb(255, 102, 0) = hsl(24, 100%, 50%) = cmyk(0%, 60%, 100%, 0%). White text scores only 2.94:1 (fails), black 7.15:1 (AAA).
Typing hsl(200, 80%, 40%) — or the modern hsl(200deg 80% 40%) — gives #1481B8 = rgb(20, 129, 184). Note that this mid-blue reaches 4.31:1 with white (large text only) and 4.87:1 with black (AA): medium-lightness colours are where you most need to check rather than guess.
What gets ignored
Typing rgba(0,0,0,0.5) converts to #000000: the alpha value is read past and dropped, because the output formats here are all opaque. Newer CSS notations such as oklch() or named colours like tomato are not recognised — the table simply keeps showing the last valid colour.
Pro tips
- Keep the HEX as your single source of truth; rounded HSL and CMYK values are derived from it, not the other way round.
- If the table stops updating while you type, the text is not yet a valid colour — finish the value and it refreshes.
- For picking colours from a photo or screenshot, use the Image Colour Picker first, then paste the hex here.
Glossary
- sRGB
- The standard colour space for the web; HEX, rgb() and hsl() all describe colours inside it.
- Key (K)
- The black ink channel in CMYK, used because mixing C, M and Y alone gives a muddy dark brown.
- Relative luminance
- A weighted measure of how bright a colour appears, used to calculate WCAG contrast ratios.
- Gamut
- The range of colours a device or colour model can reproduce.
Frequently asked questions
How do I convert HEX to RGB?
Split the HEX into three pairs and convert each from base 16 to decimal: #4F46E5 → 79, 70, 229. The tool does this instantly.
Why does my printed colour look different?
Screens mix light (RGB) while printers mix ink (CMYK), and some bright screen colours cannot be printed exactly.
What contrast ratio do I need?
At least 4.5:1 for body text and 3:1 for large headings to meet WCAG AA.
Does the converter keep transparency from rgba() or hsla()?
No. It reads the red, green and blue (or hue, saturation and lightness) values and ignores alpha, so the outputs are always fully opaque colours.
Can I enter oklch() or a colour name like teal?
Not in this tool. It understands hex, rgb()/rgba() and hsl()/hsla() only.
Why does converting my HSL back give a slightly different hex?
The table rounds HSL to whole numbers. Rounding loses a little precision, so a round trip can move a channel by one or two steps.
Last updated 2026-11-28 · Built by Vinayak Agarwal · Part of CSS & Design (37 tools)