CSS & Design Utilities

HEX to RGB / HSL Color Converter & CSS Palette Generator

Convert between HEX, RGB, HSL, HSV, CMYK, and OKLCH color codes in real time. Generate Tailwind tints, shades, and harmonic palettes with WCAG contrast ratings. 100% private in-browser.

100% Client-Side Color Space Transform • W3C CSS Color 4 Compliant • Zero Network Requests
CSS & Design Utilities
Popular Design Presets
vs White (#FFFFFF)
3.68:1
AA Large Only
vs Black (#000000)
5.71:1
AA Pass

Converted Color Formats

HEX (6-digit)
#3B82F6
HEX8 (Alpha)
#3B82F6FF
RGB
rgb(59, 130, 246)
RGBA
rgba(59, 130, 246, 1)
HSL
hsl(217, 91%, 60%)
HSLA
hsla(217, 91%, 60%, 1)
HSV / HSB
hsv(217, 76%, 96%)
CMYK (Print)
cmyk(76%, 47%, 0%, 4%)
CSS OKLCH
oklch(62% 0.19 255)

Tints & Shades Scale (Tailwind 50 - 950)

Click any swatch to copy

Color Harmonies

Export Ready CSS & Code Snippets

:root {
  --color-primary: #3B82F6;
  --color-primary-rgb: 59, 130, 246;
  --color-primary-hsl: 217deg 91% 60%;
}

HEX to RGB, HSL & OKLCH Color Space Converter & Palette Architecture

Authoritative guide to digital color models, mathematical transforms between sRGB, HSL, HSV, CMYK and OKLCH, WCAG 2.1 contrast compliance, and Tailwind CSS design scales.

01. Mathematical Architecture of Color Spaces: HEX, RGB, HSL & OKLCH

Digital screens display color through additive light blending across Red, Green, and Blue subpixels (sRGB color space). A standard 24-bit sRGB color allocates 8 bits (values from 0 to 255) per channel, allowing for 16,777,216 distinct color combinations.

HEX notation is simply a base-16 hexadecimal representation of these RGB byte values. For instance, #3B82F6 decomposes into 0x3B (59 Red), 0x82 (130 Green), and 0xF6 (246 Blue). 8-digit hexadecimal codes append an additional byte for alpha opacity (e.g. #3B82F680 represents 50% opacity).

While RGB aligns with hardware displays, human perception naturally organizes color by Hue (color angle on a 360° wheel), Saturation (chroma purity from 0% to 100%), and Lightness (luminance from 0% black to 100% white). The HSL model maps non-linearly to RGB but enables intuitive tinting, shading, and thematic harmonization.

DevOmniTools Color Converter performs 100% client-side bidirectional transformations across all modern CSS color formats, including the new wide-gamut W3C CSS Color Module 4 standard: OKLCH.

  • Instant real-time synchronization between HEX, RGB, RGBA, HSL, HSLA, HSV, CMYK, and OKLCH.
  • Automatic 11-step tints and shades generator matching Tailwind CSS 50–950 design token scales.
  • Dynamic harmonic palettes: Complementary, Triadic, Analogous, Split-Complementary, and Tetradic.
  • Built-in WCAG 2.1 relative luminance and contrast calculator against Black (#000000) and White (#FFFFFF).
Featured Answer: How to convert HEX to RGB mathematically?

To convert a 6-character hexadecimal color (#RRGGBB) to RGB, split the string into three pairs: RR, GG, and BB. Convert each two-digit base-16 number to base-10 integer using: Decimal = (Digit1 × 16) + Digit2. For example, in #3B82F6: R = (3 × 16) + 11 = 59, G = (8 × 16) + 2 = 130, B = (15 × 16) + 6 = 246, yielding rgb(59, 130, 246).

02. Step-by-Step Color Conversion and Palette Engineering Workflow

1. Paste or type any color code (HEX, rgb(...), hsl(...)) into the input field, or use the interactive color picker / screen eyedropper tool.

2. The converter immediately updates all 9 color representations with single-click copy buttons.

3. Review the Tints & Shades scale to select lighter UI backgrounds (50–200) or deeper button states (700–900).

4. Inspect the WCAG 2.1 contrast ratings to verify whether your selected color requires white (#ffffff) or black (#000000) text for accessible readability.

5. Click "Copy CSS Root Variables" to export production-ready CSS variables directly into your project stylesheet.

03. Why OKLCH is Replacing HSL in Modern CSS Architecture

Traditional HSL suffers from perceptual non-uniformity: a pure yellow (hsl(60, 100%, 50%)) appears dramatically brighter to the human eye than a pure blue (hsl(240, 100%, 50%)), even though both claim 50% lightness.

The OKLCH color space (Oklab polar coordinates) solves this by maintaining uniform perceived lightness across the entire color spectrum. Adjusting hue in OKLCH preserves consistent visual contrast, making it the ideal choice for dynamic design tokens and accessible dark/light theme switching in CSS.

Frequently Asked Questions (FAQ)

How do I convert a 3-digit shorthand HEX code to 6-digit?

Duplicate each single hexadecimal character: #ABC expands directly to #AABBCC. In RGB, this maps to red: 0xAA (170), green: 0xBB (187), and blue: 0xCC (204).

What is the difference between HSL and HSV/HSB?

Both use Hue and Saturation, but HSL defines Lightness (50% is pure color, 100% is pure white), while HSV defines Value/Brightness (100% is pure color, and adding black reduces Value toward 0%).

Does this color converter send my inputs to an external server?

No. All mathematical color conversions, matrix transformations, and palette calculations execute exclusively in your browser memory.

More free tools that run safely in your web browser.