~/tools/color-converter
Color Converter
Convert between HEX, RGB, HSL, and OKLCH instantly. Includes WCAG contrast checker, CSS variable output, and color palette generator. Runs entirely in your browser.
What is a Color Converter?
A color converter translates a color value from one representation into equivalent values in other formats. Since different systems and tools use different color models — CSS might expect HEX, a design tool might use HSL, and modern browsers increasingly support OKLCH — a converter lets you move between them without manual calculation.
This tool converts between four formats: HEX (the classic web standard), RGB (the screen model), HSL (human-friendly hue/saturation/lightness), and OKLCH (the modern perceptually uniform CSS Color Level 4 format). All conversions happen instantly in your browser.
Color Formats Explained
WCAG Contrast Explained
WCAG (Web Content Accessibility Guidelines) defines minimum contrast ratios to ensure text is readable by people with low vision. Contrast ratio is calculated from relative luminance: (lighter + 0.05) / (darker + 0.05).
AA (Normal text)
Minimum ratio of 4.5:1 for body text under 18pt (or 14pt bold). Required for basic accessibility compliance in most public-facing web content.
AAA (Normal text)
Enhanced ratio of 7:1 for normal text. Recommended for body text in high-accessibility contexts such as legal, medical, or government sites.
AA (Large text)
Minimum ratio of 3:1 for large text (18pt or 14pt bold). Also applies to UI components, icons, and graphical elements.
AAA (Large text)
Enhanced ratio of 4.5:1 for large text. The gold standard for headings and prominent UI elements in accessible design systems.
Common Use Cases
Design System Tokens
Convert brand colors from HEX (provided by designers) into OKLCH CSS custom properties for modern design token systems.
Accessibility Audit
Check foreground/background color pairs for WCAG AA or AAA compliance before shipping UI components.
CSS Color Level 4 Migration
Convert legacy HEX and RGB values to OKLCH for perceptually uniform color manipulation in modern CSS.
Palette Generation
Use the built-in complement, triadic, lighter, darker, and muted swatches to build cohesive color palettes from a single seed color.
Cross-tool Color Sync
Figma exports HEX, Tailwind uses HEX, SVGs use RGB, and WebGL shaders use normalized 0–1 floats. Convert once to use everywhere.
Theme Development
Generate both light and dark variants of a hue by adjusting the lightness channel in HSL or OKLCH without losing hue consistency.