Free Online CSS Color Converter
Instant bidirectional color conversion across HEX, RGB, HSL, HSV, CMYK, and modern OKLCH with alpha support and WCAG accessibility contrast ratios.
Come usare Color Converter (3 semplici passaggi)
Input or Pick Your Color
Type or paste any color string in HEX, RGB, HSL, CMYK, or OKLCH format, or use the interactive 2D canvas color picker.
Adjust Alpha & Compare Values
Fine-tune the opacity channel with the alpha slider and compare simultaneous conversions across all 6 color spaces.
Check WCAG & Copy Code
Inspect WCAG AA and AAA accessibility contrast scores, then copy individual values, Tailwind classes, or CSS custom properties with one click.
Caratteristiche principali e best practice CSS
Modern OKLCH Color Space Support
Includes modern Björn Ottosson OKLCH color conversions with perceptual uniformity for consistent lightness and vibrant CSS palettes.
Bidirectional Multi-Format Sync
Edit any input field—HEX, RGB, HSL, HSV, CMYK, or OKLCH—and all other formats update instantly in real time.
WCAG 2.1 Contrast & Accessibility
Calculates relative luminance and contrast ratios against pure black and white surfaces, with instant AA/AAA compliance badges.
Developer-First Export Options
Export formatted CSS declarations, CSS custom properties (:root variables), Tailwind CSS utility classes, or structured JSON data.
Domande frequenti
What color formats does this converter support?
This tool supports HEX (3, 6, and 8-digit with alpha), RGB and RGBA, HSL and HSLA, HSV/HSB, CMYK, and the modern W3C CSS Color Module Level 4 OKLCH format.
What is OKLCH and why should I use it in modern CSS?
OKLCH is a perceptually uniform color space designed by Björn Ottosson. Unlike sRGB or HSL, two colors with the same OKLCH lightness (L) value appear equally bright to the human eye, eliminating muddy transitions in gradients and making accessible UI palette generation predictable.
How does the alpha channel work across different formats?
The alpha channel slider ranges from 0.0 (fully transparent) to 1.0 (fully opaque). It formats as an 8-character hex code (e.g. #6366f1cc), rgba(99, 102, 241, 0.8), hsla(238, 83%, 67%, 0.8), or oklch(0.55 0.22 278 / 0.8).
How is WCAG contrast calculated?
We calculate relative luminance according to the W3C WCAG 2.1 specification and compute contrast ratios against pure white (#FFFFFF) and deep black (#000000). A ratio of 4.5:1 passes WCAG AA for normal text, while 7:1 passes AAA.
Does this tool send my colors to an external server?
No. All mathematical conversions, color calculations, and palette history run 100% locally in your browser using client-side JavaScript. Your designs and color palettes remain completely private.
Can I copy CSS variables or Tailwind CSS classes directly?
Yes! Quick export buttons allow you to copy ready-to-paste CSS custom properties (--color: ...), Tailwind CSS background and text classes, or structured JSON objects for design token systems.
Complete Guide to CSS Color Formats: From HEX to OKLCH
Color is one of the most fundamental design elements on the web. Over the history of CSS, developers have transitioned from basic 16-color keywords and hexadecimal codes to modern, perceptually uniform color spaces like OKLCH.
Understanding how each color model works enables developers and UI designers to choose the optimal format for branding, user interface design, accessibility compliance, and dynamic theming.
The Evolution of Color on the Web
- HEX & RGB: Direct representations of screen hardware channels (Red, Green, Blue). While standard and compact, HEX and RGB are difficult to adjust mentally (e.g., making a color 10% darker without shifting its hue).
- HSL & HSV: Cylindrical transformations of RGB dividing color into Hue, Saturation, and Lightness/Value. Much easier to tweak by hand, but not perceptually uniform (e.g. pure yellow at 50% lightness looks dramatically brighter than pure blue at 50% lightness).
- CMYK: The subtractive four-color printing model (Cyan, Magenta, Yellow, Key/Black). Useful when aligning digital design tokens with print collateral.
- OKLCH: Part of CSS Color Module Level 4. OKLCH features true perceptual uniformity, meaning lightness changes do not cause unwanted hue shifts or uneven brightness across different colors.
:root {
--primary: oklch(0.58 0.23 275);
--primary-hover: oklch(0.52 0.23 275);
--primary-subtle: oklch(0.95 0.05 275 / 0.4);
}
.btn-primary {
background-color: var(--primary);
color: #ffffff;
transition: background-color 150ms ease;
}
.btn-primary:hover {
background-color: var(--primary-hover);
}
/* HEX with 80% opacity */
color: #6366f1cc;
/* Standard RGBA */
color: rgba(99, 102, 241, 0.8);
/* Modern CSS HSL space-separated */
color: hsl(238.3 83.5% 66.7% / 80%);
/* W3C OKLCH */
color: oklch(0.58 0.23 275 / 0.8);
Compatibilità dei browser e supporto agli standard
Verificato sui motori dei browser moderni per desktop e dispositivi mobili secondo le specifiche W3C.
| Color Format | Chrome | Firefox | Safari | Edge |
|---|---|---|---|---|
| HEX (#RGB / #RRGGBB) | All | All | All | All |
| HEX with Alpha (#RRGGBBAA) | 62+ | 49+ | 10+ | 79+ |
| rgb() / rgba() | All | All | All | All |
| hsl() / hsla() | All | All | All | All |
| oklch() (CSS Color 4) | 111+ | 113+ | 15.4+ | 111+ |
| color-mix() | 111+ | 113+ | 16.2+ | 111+ |
Best practice di architettura e consigli per la produzione
💡 Use OKLCH for Accessible Palette Generation
Because OKLCH lightness (L) reflects true perceived human brightness, you can generate 10-step accessible shade scales by simply stepping the L channel from 0.1 to 0.9 while holding chroma and hue constant.
💡 Always Validate Contrast with Real Backgrounds
When designing light or dark themes, test your colors against the exact background token they will sit on. Use the WCAG score badges to ensure at least 4.5:1 for body copy and 3:1 for interactive controls.