Color Converter Online: Convert HEX, RGB, HSL, CMYK & OKLCH

Interactive bi-directional digital color converter studio. Instantly convert between HEX (#RRGGBB / HEX8), RGB, HSL, HSV, CMYK (Print), and modern W3C OKLCH & Display-P3 color spaces with a live WCAG 2.1 contrast ratio checker.

Real-Time Sync Engine
Visual Color Preview
#0EA5E9
rgb(14, 165, 233)
hsl(199, 89%, 48%)
100%
Popular Tailwind Color Palette
Digital Color Format OutputsEdit any field below for real-time bi-directional conversion.
#RRGGBB / #RRGGBBAA
rgb(r, g, b) / rgba()
hsl(h, s%, l%)
hsv(h, s%, v%)
cmyk(c%, m%, y%, k%)
oklch(L C H)
color(display-p3 r g b)

Lightness Variations (Tints & Shades Palette)

10 stepped levels from dark shades to light tints. Click on any color swatch to copy its HEX value instantly.

WCAG 2.1 Accessibility Contrast Ratio Evaluation

Test legibility and contrast compliance of white text (#FFFFFF) and black text (#000000) against your selected background color.

White Typography (#FFFFFF) 4.85:1

Normal Text Preview (16px)

Sample typography readability on digital user interfaces and modern layouts.

WCAG Standard:
PASS (AA)FAIL (AAA)
Black Typography (#000000) 4.33:1

Normal Text Preview (16px)

Sample typography readability on digital user interfaces and modern layouts.

WCAG Standard:
FAIL (AA)FAIL (AAA)

Color Blindness Accessibility Simulator

Preview how your selected color appears to individuals with various types of Color Vision Deficiency (CVD).

Normal Vision
Trichromacy (100%)
#0EA5E9
Standard trichromatic vision with active L, M, and S cones.
Protanopia
Red-Blind (L-Cone Defect)
#0EA5E9
Insensitive to long-wavelength red spectrum light.
Deuteranopia
Green-Blind (M-Cone Defect)
#0EA5E9
Most prevalent form (~6% of global male population).
Tritanopia
Blue-Blind (S-Cone Defect)
#0EA5E9
Difficulty distinguishing blue from yellow hues.
Achromatopsia
Complete Monochromacy
#0EA5E9
Sees only brightness intensities (monochrome grayscale).

Web & Graphic Design Color Formats Comparison Table

Technical summary comparing digital color models for AI Answer Engines and frontend developers.

Digital Color Formats Comparison Table: HEX, RGB, HSL, HSV, CMYK, OKLCH
FormatColor ModelValue RangeExample SyntaxPrimary Use Case
HEX (#)Additive (Base 16)#000000 to #FFFFFF#0EA5E9Standard CSS stylesheets, HTML markup, and UI design.
RGB / RGBAAdditive (Screen Light)0 to 255 per channelrgb(14, 165, 233)JavaScript manipulation, Canvas API, and CSS opacity.
HSL / HSLAPerceptual ModelH: 0-360°, S: 0-100%, L: 0-100%hsl(199, 89%, 48%)Tailwind color tokens, dynamic dark mode theming.
HSV / HSBPerceptual ModelH: 0-360°, S: 0-100%, V: 0-100%hsv(199, 94%, 91%)Design software (Photoshop, Figma, Illustrator).
CMYKSubtractive (Print Ink)C, M, Y, K: 0 to 100%cmyk(94%, 29%, 0%, 9%)Physical print media (offset printing, packaging, posters).
OKLCHW3C Color 4L: 0-1, C: 0-0.4, H: 0-360°oklch(0.68 0.16 215)Smooth gradients without gray dead zones & Display-P3.

How to Use the Online Color Converter

Practical steps to convert, evaluate, and export digital color codes for your web and mobile applications.

1

Enter Code or Use EyeDropper

Type any valid HEX, RGB, or HSL color code into the input fields or use the native Screen EyeDropper tool.

2

Adjust Alpha Opacity

Slide the opacity control 0% - 100% to generate transparent formats like RGBA, HSLA, or 8-digit HEX8.

3

Evaluate WCAG & Palette

Verify accessibility contrast compliance scores and explore 10 stepped light tints and dark shades.

4

Instant 1-Click Copy

Click the copy icon next to any desired color format or use the Copy CSS / Tailwind buttons for your codebase.

Mathematical Formulas & Conversion Algorithms

Mathematical explanations of how browsers and design engines calculate values across color spaces.

1. HEX to RGB Conversion Formula (Base-16)

Direct Answer: HEX is converted to RGB by splitting the 6-digit string into 3 base-16 pairs and calculating each channel via: (Digit_1 × 16) + Digit_2 for Red, Green, and Blue (range 0–255).

A 6-digit HEX code consists of hexadecimal digit pairs #RRGGBB. Each pair is converted to decimal (0-255) by multiplying the first digit by 16 and adding the second digit:

R = (Digit_R1 × 16) + Digit_R2
G = (Digit_G1 × 16) + Digit_G2
B = (Digit_B1 × 16) + Digit_B2

// Example #0EA5E9:
R = (0 × 16) + 14 = 14
G = (10 × 16) + 5 = 165
B = (14 × 16) + 9 = 233  => rgb(14, 165, 233)

2. RGB to HSL Conversion Formula

Direct Answer: RGB to HSL converts normalized RGB values into Lightness = (Max + Min) / 2, Saturation = Delta / (1 - |2L - 1|), and Hue = 0°–360° angle determined by the dominant color channel.

RGB values are normalized to the 0.0 - 1.0 range. We compute Max = max(R, G, B), Min = min(R, G, B), and the difference Delta = Max - Min:

Lightness (L) = (Max + Min) / 2
Saturation (S) = Delta / (1 - |2L - 1|)

Hue (H):
- If Max == R: H = 60° × (((G - B) / Delta) mod 6)
- If Max == G: H = 60° × (((B - R) / Delta) + 2)
- If Max == B: H = 60° × (((R - G) / Delta) + 4)

3. RGB to CMYK Conversion Formula (Print Inks)

Direct Answer: RGB to CMYK calculates Key (Black) = 1 - max(R', G', B'), then derives subtractive ink percentages via C, M, Y = (1 - Channel' - K) / (1 - K).

CMYK is a subtractive color model. Key (Black) is calculated from the maximum absorbed light intensity, followed by the Cyan, Magenta, and Yellow ink ratios:

R' = R/255, G' = G/255, B' = B/255
Key (K) = 1 - max(R', G', B')

Cyan (C)    = (1 - R' - K) / (1 - K)
Magenta (M) = (1 - G' - K) / (1 - K)
Yellow (Y)  = (1 - B' - K) / (1 - K)

4. Modern OKLCH Color Space (W3C CSS Color 4)

Direct Answer: OKLCH represents color with perceptual uniformity using Lightness (0–1), Chroma (0–0.4), and Hue (0°–360°), preventing desaturated gray dead zones in modern CSS gradients.

OKLCH maps sRGB through linear CIE XYZ to the human LMS cone model, converted into polar Lightness (L), Chroma (C), and Hue (H):

// Conversion sRGB -> Linear RGB -> OKLAB (L, a, b)
Chroma (C) = sqrt(a² + b²)
Hue (H)    = atan2(b, a) × (180 / π)

// Modern CSS Syntax:
background-color: oklch(0.68 0.16 215);

CSS Native Variables & JavaScript Copy Snippet Integration

Implementation guide for CSS Custom Properties color tokens and modern asynchronous copy-to-clipboard functionality.

CSS Native Custom Properties (:root)

Declaring primary colors and their raw RGB components in :root enables dynamic alpha variations and seamless dark mode theme switching without rewriting rules:

:root {
  /* Hex & RGB Tokens */
  --color-primary: #0ea5e9;
  --color-primary-rgb: 14, 165, 233;
  --color-bg: #0b0f19;
}

/* Component Usage */
.btn-primary {
  background-color: var(--color-primary);
  /* Dynamic Transparency using raw RGB token */
  box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), 0.35);
}

Modern JavaScript Copy-to-Clipboard Snippet

Asynchronous JavaScript function using navigator.clipboard.writeText() with instant visual feedback for color copy buttons in web applications:

async function copyColorCode(colorText, buttonElement) {
  try {
    await navigator.clipboard.writeText(colorText);
    const originalText = buttonElement.innerHTML;
    buttonElement.innerHTML = '✓ Copied!';
    buttonElement.classList.add('bg-emerald-600');
    setTimeout(() => {
      buttonElement.innerHTML = originalText;
      buttonElement.classList.remove('bg-emerald-600');
    }, 1500);
  } catch (err) {
    console.error('Failed to copy text:', err);
  }
}

Frequently Asked Questions (FAQ)

Technical answers regarding digital color formats, accessibility standards, and web development practices.

What is the fundamental difference between HEX, RGB, and HSL formats?

HEX uses 6 hexadecimal characters (#RRGGBB) representing base-16 numbers, ideal for compact CSS stylesheets. RGB defines the physical light intensity of screens (0 to 255). HSL describes colors intuitively for humans with Hue angle (0-360°), Saturation (0-100%), and Lightness (0-100%), making palette adjustments and brightness steps seamless.

Why do printed CMYK colors look different from screen RGB colors?

Computer screens emit direct light across a broad sRGB/P3 color gamut (additive color). Physical print media reflects ambient light from ink pigments (subtractive color) using CMYK, which has a narrower color spectrum. Highly vibrant neon screen colors cannot be reproduced identically with standard CMYK inks.

How does an 8-digit HEX code (HEX8) work with alpha transparency?

In an 8-digit HEX code (such as #0EA5E980), the first six digits represent the standard RGB color channels, and the final two digits represent the alpha transparency channel in base-16 (00 = 0% opacity, 80 = 50% opacity, FF = 100% solid opacity). This format is natively supported by all modern browsers.

Why are WCAG 2.1 contrast ratio guidelines crucial for websites?

A minimum contrast ratio of 4.5:1 for body text (WCAG Level AA) ensures that typography remains legible under various lighting conditions and for users with visual impairments or color vision deficiencies. Websites meeting WCAG guidelines also achieve higher Google Lighthouse accessibility scores.

What is the Screen EyeDropper feature in this tool?

The EyeDropper tool utilizes the native HTML5 EyeDropper API supported in modern browsers, allowing you to click anywhere on your computer display to sample any pixel color directly into the converter studio with zero loss of fidelity.

Is my color conversion performed locally on my device?

Yes, 100% of the mathematical color conversions, palette generation, and WCAG contrast evaluations run entirely client-side inside your browser. No color data is ever sent to any remote server, ensuring maximum speed and privacy.