Free Color Converter
Convert colors between HEX, RGB, HSL, HSV, and CMYK formats instantly. Includes a lightness scale and preset swatches.
Convert a color between HEX, RGB, HSL, HSV and CMYK β with a live preview and one-tap copy. Everything runs in your browser.
Accepts: HEX (#fff or #ffffff), RGB (255, 255, 255), or HSL (360, 100%, 50%)
WCAG contrast
On white background
2.49:1
On black background
8.44:1
Lightness scale
Click any swatch to switch to that shade
Common uses
- Convert Colors for Web DesignGet HEX, RGB, and HSL values for any colour β ready to paste into CSS or Tailwind.
- Convert Colors for Print (CMYK)Convert screen colours (HEX/RGB) to CMYK values for use in print design and professional printing.
- Build Color Palettes for Design SystemsConvert brand colours across all formats and generate consistent lightness scales for a full design system.
- Check Colour Contrast for AccessibilityConvert colours to get RGB values for use in contrast ratio tools β WCAG compliance for accessible design.
- Convert Colors for FigmaGet the exact HEX and RGB values to paste into Figma colour pickers and design token systems.
How It Works
All conversion logic is hand-written JavaScript running entirely in your browser β no library, no server call. The tool parses your input, routes it through a chain of pure math functions, and simultaneously produces eleven output formats including the modern CSS Color 4 spaces oklch() and lab().
- 1Flexible input parsingA custom parser accepts hex (3, 4, 6, or 8 digits), rgb()/rgba(), hsl()/hsla() in both legacy comma syntax and modern space syntax, and bare numeric triples. Alpha values as decimals or percentages are normalized to the 0β1 range before any conversion begins.
- 2RGB as the conversion hubEvery accepted format is first resolved to a canonical RGB triplet. From that single representation the tool fans out: HSL and HSV use the standard min/max/chroma formulas; CMYK is derived by finding the key channel; and sRGB linearization (the piecewise gamma curve defined in IEC 61966-2-1) is applied before the perceptual-space calculations.
- 3Perceptual color spaces computed from scratchoklch() is computed using BjΓΆrn Ottosson's reference 3Γ3 matrices (LMS cube-root space). lab() and lch() use Bradford chromatic adaptation to convert from the D65 white point to D50, which matches how CSS Color 4 defines lab(). These are the same formulas used in browser rendering engines β implemented here without any external dependency.
- 4WCAG contrast and lightness scaleRelative luminance is calculated per the WCAG 2.1 formula (linearized R, G, B weighted 0.2126/0.7152/0.0722) and the contrast ratio against white and black is graded AA-large, AA, AAA, or Fail. A nine-step lightness strip is generated by stepping the HSL lightness channel from 10% to 90%, letting you click any swatch to convert that shade.
Related Tools
Color Picker & Palette Generator
Pick colors, convert between HEX/RGB/HSL, and generate harmonious palettes.
Random Color Generator
Generate random colours one at a time or as a palette of five, lock the ones you like, copy HEX, RGB or HSL values and export the palette as PNG or CSS.
Color Palette Generator
Generate complementary, analogous, triadic, and monochromatic color palettes from any base color. Copy hex codes in one click.