Color Converter
Convert colors between HEX, RGB, RGBA, HSL, HSV, and CMYK. Pick any color and instantly see all format representations with one-click copy.
What is a Color Converter?
A color converter translates a color between different mathematical color models — each designed for a specific use case. HEX (hexadecimal) and RGB (Red, Green, Blue) are additive models used on screens and in web development, where colors are defined by the intensity of red, green, and blue light. HEX is simply RGB encoded in base-16 notation — #3b82f6 corresponds to R=59, G=130, B=246. Both models describe the same color space; HEX is just the web's shorthand for CSS styling.
HSL (Hue, Saturation, Lightness) and HSV (Hue, Saturation, Value) are cylindrical representations of RGB designed to be more intuitive for designers. Instead of specifying three independent primary light intensities, you specify the color angle on the color wheel (hue), how vivid or grey the color is (saturation), and how light or dark it appears (lightness or value). These models make it much easier to programmatically adjust color properties — for example, generating a palette of tints and shades by simply varying the lightness while holding hue and saturation constant.
CMYK (Cyan, Magenta, Yellow, Key/Black) is a subtractive color model used in physical printing. Unlike digital screens that emit light, printed materials reflect and absorb light — CMYK inks each absorb specific wavelengths. The conversion from RGB to CMYK is approximate because the RGB gamut (range of representable colors) is larger than what physical inks can reproduce; colors that appear vivid on a monitor may appear duller when printed. The WCAG contrast ratio checker included in this tool assesses the accessibility of your color against white and black backgrounds — a critical consideration for readable web typography.
Conversion Formulas
G = parseInt(hex[3..4], 16)
B = parseInt(hex[5..6], 16)
max = max(R',G',B'), min = min(R',G',B')
L = (max + min) / 2
S = (max - min) / (1 - |2L - 1|)
H = 60 x sector based on which channel is max
How the Color Converter Works
Formula, assumptions, and calculation steps for this dev tools tool.
Formula Used
RGB to HEX uses direct base-16 mapping; RGB to HSL uses standard colorimetric conversion formulas
Methodology
Converts between HEX, RGB, and HSL color models using standard colorimetric formulas that account for hue, saturation, and lightness.
Calculation Steps
- Provide the input text or select generation options.
- Apply the selected encoding, parsing, hashing, or formatting rule.
- Validate the output where possible.
- Return copy-ready developer output.
Assumptions and Limits
- Generated or transformed output depends exactly on the supplied input.
- Security-sensitive values should be handled carefully.
- Browser tools do not replace production validation.
Frequently Asked Questions
HSL stands for Hue, Saturation, and Lightness. Hue is the color angle (0–360°), Saturation is how vivid the color is (0–100%), and Lightness is how light or dark it is (0% = black, 50% = pure color, 100% = white). HSL is often more intuitive for designers than RGB.
CMYK stands for Cyan, Magenta, Yellow, and Key (Black). It is a subtractive color model used in color printing. Unlike RGB (which adds light), CMYK subtracts light — inks absorb certain wavelengths. Printers use CMYK inks to produce a wide range of colors on paper.
Split the hex code into three pairs: the first pair is Red, second Green, third Blue. Convert each pair from base-16 to base-10. For example, #3b82f6 → R=59 (0x3b), G=130 (0x82), B=246 (0xf6).
The WCAG (Web Content Accessibility Guidelines) contrast ratio measures the relative luminance difference between two colors. A ratio of 4.5:1 passes AA for normal text, and 7:1 passes AAA. For large text (18pt+), AA requires 3:1. Always ensure sufficient contrast for readability.
Real-World Applications
Common Mistakes
Color Model Quick Reference
| Model | Range | Additive/Subtractive | Primary Use |
|---|---|---|---|
| HEX | #000000–#FFFFFF | Additive | CSS, HTML, web design |
| RGB | 0–255 per channel | Additive | Screens, digital images |
| HSL | H:0–360° S/L:0–100% | Additive | CSS custom properties, palettes |
| HSV | H:0–360° S/V:0–100% | Additive | Design tools (Photoshop, Figma) |
| CMYK | 0–100% per channel | Subtractive | Offset printing, packaging |
References
- World Wide Web Consortium. CSS Color Module Level 4. w3.org/TR/css-color-4.
- Web Content Accessibility Guidelines (WCAG) 2.1. Success Criterion 1.4.3: Contrast (Minimum). w3.org/TR/WCAG21.
- International Commission on Illumination (CIE). CIE 015:2004 — Colorimetry, 3rd ed. cie.co.at.
- Foley, J. D. et al. Computer Graphics: Principles and Practice, 3rd ed. Addison-Wesley, 2013.
- Adobe Systems. Understanding Color Models. helpx.adobe.com.
Related Calculators
Browse all Dev Tools calculators →Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from any text.
Binary Converter
Convert numbers between binary, decimal, octal, and hexadecimal.
Hex Converter
Convert between hexadecimal, decimal, binary, and text (ASCII/UTF-8).