Colour Converter Widget
Add a colour converter to your design tutorial or brand page. Paste a colour in any common format - hex, rgb(), hsl(), hsv(), cmyk() or a CSS name - and copy it back out in every other format.
Live preview
Exactly what your visitors will seeUnder the widget on your page: Powered by A2Z Tools
Embed code
<iframe src="https://a2z.tools/embed/w/color-converter" title="Colour Converter by A2Z Tools" width="100%" height="580" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>
A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.
<div data-a2z-widget="color-converter" data-height="580"></div> <script async src="https://a2z.tools/embed.js"></script>
Adds a small script (what it does) that sizes the widget to fit its content, loads it lazily and keeps it isolated from your page's CSS.
Works with
How it works
CSS colour formats and the 148 CSS named colours are read by A2Z's shared colour engine; hsv() and cmyk() are read by the widget itself. Everything is converted through 8-bit sRGB, so each output is exactly what a browser would paint. HSL and HSV values are shown to one decimal place so round trips stay accurate. CMYK uses the simple device-independent formula, which is useful for a starting point but is not what a print shop's colour profile would produce - the widget says so under the result.
Method
- R', G', B' = R, G, B / 255; max, min and delta = max - min
- HSL: L = (max + min) / 2; S = delta / (1 - |2L - 1|); H from the dominant channel x 60 degrees
- HSV: V = max; S = delta / max; H as for HSL
- CMYK (naive): K = 1 - max; C = (1 - R' - K) / (1 - K), same for M and Y
- Outputs rounded: RGB to whole numbers, HSL/HSV to 0.1, CMYK to 0.1%; alpha to 3 decimals
Limitations
- CMYK is the device-independent textbook formula with no ICC profile, ink limit or dot gain, so it is a starting point only, not a press-ready value.
- Everything is treated as sRGB. Display P3, Lab, LCH and OKLCH colours are not read or produced.
- Pantone and other proprietary swatch names are not included; only the 148 CSS named colours are recognised.
- Because channels are 8-bit, converting HSL or CMYK in and back out can move a value by a rounding step.
Where publishers use it
- CSS and front-end tutorials that move between hex and hsl()
- Brand guidelines that list a colour in screen and print notation
- Designers handing colours between tools that use different models
- Teaching colour models in a digital-media course
Questions
Is the CMYK value print-ready?
No. It is the naive device-independent conversion. Real print colour depends on the ink, the paper and an ICC profile, so ask your printer to convert with their profile.
What is the difference between HSL and HSV?
Both describe hue and saturation, but HSL's third value is lightness (50% is the pure colour, 100% is white) while HSV's is value or brightness (100% is the pure colour). HSB is another name for HSV.
Does it keep transparency?
Yes for HEX (8 digits), rgba() and hsla(). HSV and CMYK have no alpha channel, so it is dropped there.
Which inputs are accepted?
#rgb, #rrggbb, #rrggbbaa, hex without #, rgb()/rgba() with commas or spaces, hsl()/hsla(), hsv()/hsb(), cmyk() and CSS colour names such as tomato.
Sources
- CSS Color Module Level 4 - sRGB, hsl() and named colours - W3C . hex, rgb(), hsl() syntax, HSL-to-RGB conversion and the named-colour table
- Color Gamut Transform Pairs (A. R. Smith, SIGGRAPH '78) - ACM . the original RGB-HSV (hexcone) transform
Cite or recommend this tool
If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.
A2Z Tools Colour Converter https://a2z.tools/color-code-converter
<a href="https://a2z.tools/color-code-converter">A2Z Tools Colour Converter</a>
[A2Z Tools Colour Converter](https://a2z.tools/color-code-converter)
Colour Converter by A2Z Tools - https://a2z.tools/color-code-converter
Related widgets
-
WCAG 2.x contrast ratio of two colours, AA/AAA results and the nearest passing shade.
-
Complementary, analogous, triadic, split, tetradic and monochrome palettes from one colour.
-
Build a linear or radial CSS gradient with 2-5 colour stops and copy the code.
-
Simplify width x height to a ratio and resize to a new width or height without distortion.
-
Convert pixels to rem (and back) for any root font size, with a table of common sizes.