Advertisement

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.

Tints (lighter)
Shades (darker)
WCAG Contrast Checker
vs. White (#FFF)
vs. Black (#000)

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

HEX to RGB
R = parseInt(hex[1..2], 16)
G = parseInt(hex[3..4], 16)
B = parseInt(hex[5..6], 16)
RGB to HSL
R' = R/255, G' = G/255, B' = B/255
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

  1. Provide the input text or select generation options.
  2. Apply the selected encoding, parsing, hashing, or formatting rule.
  3. Validate the output where possible.
  4. 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

🎨
Web & UI Design
Designers convert brand colors from HEX (CSS) to HSL to generate accessible tint/shade palettes programmatically, and back to HEX for CSS implementation — without visual guessing or manual iteration.
🖨️
Print Production
Graphic designers convert RGB colors (screen-optimised) to CMYK before submitting files to print houses — preventing the disappointment of colors that look vibrant on screen but print as dull or muddy.
Accessibility Auditing
UX engineers use contrast ratio calculators to verify text/background color combinations meet WCAG AA (4.5:1 for normal text) and AAA (7:1) standards — required for compliance with accessibility laws in many jurisdictions.
💻
Design System Tokenisation
Design systems engineers convert brand colors to HSL to define semantic tokens (--color-primary-500, --color-primary-600) where the lightness value increments systematically across a scale from 100 (lightest) to 900 (darkest).
📸
Photo Editing & Colour Grading
Photographers and video editors switch between HSV (Photoshop's native color picker model) and RGB/HEX to match specific brand colors or reproduce colors from reference images in their editing software.
🔬
Scientific Visualisation
Data scientists convert between color spaces to design perceptually uniform color maps for scientific visualisations — where equal distances in data should correspond to equal perceptual differences in color intensity.

Common Mistakes

1
Confusing HSL and HSV
HSL (Hue, Saturation, Lightness) and HSV (Hue, Saturation, Value) are different color models. A pure, vivid color has S=100% in both, but L=50% in HSL and V=100% in HSV. Photoshop uses HSV; CSS uses HSL. Using the wrong model produces incorrect output colors.
2
Using CMYK for Screen Design
CMYK is a subtractive model for print. Using CMYK values in CSS or design tools intended for screen output produces unexpected results, because screens use the additive RGB model. Always use RGB/HEX/HSL for anything displayed on a screen.
3
Assuming Screen Colors Will Match Print
The RGB gamut is significantly wider than what CMYK inks can reproduce. Highly saturated colors (neon greens, electric blues) that look vivid on screen will appear duller when printed. Always perform a soft-proof in print color space before final production.
4
Choosing a Low-Contrast Text/Background Pair
Text that looks readable in design tools at full size may fail WCAG contrast at body text size. Always verify contrast ratios at the actual intended font size using the WCAG checker — especially for gray-on-white or light-brand-color-on-white combinations popular in modern flat design.
5
Forgetting that HEX is Case-Insensitive
#3b82f6 and #3B82F6 represent the same color. However, case inconsistency in codebases can cause false positives in diff tools, linters, and design system audits. Agree on a consistent convention (all lowercase is the most common CSS standard) and enforce it with tooling.

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

  1. World Wide Web Consortium. CSS Color Module Level 4. w3.org/TR/css-color-4.
  2. Web Content Accessibility Guidelines (WCAG) 2.1. Success Criterion 1.4.3: Contrast (Minimum). w3.org/TR/WCAG21.
  3. International Commission on Illumination (CIE). CIE 015:2004 — Colorimetry, 3rd ed. cie.co.at.
  4. Foley, J. D. et al. Computer Graphics: Principles and Practice, 3rd ed. Addison-Wesley, 2013.
  5. Adobe Systems. Understanding Color Models. helpx.adobe.com.