NEWFree Color Math Tool

Color Math:
HEX · RGB · HSL · CMYK

Real-time color conversion with Color Math — convert between HEX, RGB, HSL, and CMYK, generate palettes, and verify WCAG contrast ratios instantly in your browser.
Ad

Why Color Math Matters

Every designer and developer hits these roadblocks when switching between color formats.

Format fragmentation slows you down

Design tools output HEX, CSS wants HSL, and printers demand CMYK. Without Color Math, you manually guess conversions or hop between multiple sites — wasting critical workflow time.

Manual calculations introduce errors

Converting RGB to HSL by hand involves trigonometry. A single typo in the formula flips your hue by 180°. Color Math performs all the math instantly and correctly every time.

Accessibility is an afterthought

Most color pickers ignore WCAG 2.1 contrast requirements. Color Math surfaces contrast ratios immediately, so accessibility is baked into your workflow from the first pick.

Color Preview

#3B82F6

rgb(59, 130, 246)

R — Red
G — Green
B — Blue
rgb(59, 130, 246)

Color Palette

Current

Complementary

Analogous

Triadic

Click any swatch to load it

WCAG Contrast

vs White3.68:1
AA NormalAAA NormalAA Large
vs Black5.71:1
AA NormalAAA NormalAA Large

White text on color

Black text on color

Color History

Saved colors appear here

HEX
#3B82F6
RGB
rgb(59, 130, 246)
HSL
hsl(217, 91%, 60%)
CMYK
cmyk(76%, 47%, 0%, 4%)

Everything Color Math Handles

One tool, every color system. Color Math eliminates the need for multiple converters.

Real-Time Bidirectional Conversion

Edit any field — HEX, RGB, HSL, or CMYK — and Color Math instantly recalculates all other formats. No submit button needed.

Precision Sliders for Every Channel

Drag R, G, B, H, S, L, C, M, Y, K sliders and watch all formats update live. Perfect for fine-tuning shades without touching the keyboard.

Automatic Palette Generation

Color Math generates complementary, analogous, and triadic palettes from your current color. Click any swatch to instantly load it as your working color.

WCAG 2.1 Contrast Checker

See contrast ratios against white and black at a glance. Color Math labels each result as AA, AAA, or fail — keeping your designs accessible by default.

Color History with localStorage

Every saved color persists in your browser across sessions. Color Math stores up to 10 recent colors so you can revisit and compare swatches anytime.

Zero Server, Total Privacy

Every calculation in Color Math runs entirely in your browser. No data is transmitted, no account required — your colors stay yours.

How Designers Use Color Math

From bridging design and code to printing and accessibility — Color Math fits every stage of your color workflow.

Bridge Design & Code in Seconds

Got a HEX from Figma? Paste it into Color Math and instantly get the HSL equivalent for your CSS custom properties. Adjust lightness to generate hover and focus states without touching the design file again.

Color Math tool showing HEX, RGB, HSL, and CMYK values side by side with interactive sliders

Preview Print Colors Before You Print

Color Math converts your screen RGB to theoretical CMYK values so you can spot out-of-gamut reds and oranges before sending files to the printer. Catch costly surprises at zero cost.

Color Math palette panel showing complementary, analogous, and triadic color swatches

Verify Accessibility on Every Color

Color Math calculates WCAG 2.1 contrast ratios against white and black in real time. Know immediately whether your text color meets AA or AAA requirements — no separate tool needed.

Color Math WCAG contrast checker showing pass and fail badges for AA and AAA accessibility levels

How to Use Color Math

Three steps to convert, explore, and save any color.

01

Enter or Paste a Color

Type a HEX code (shorthand like #f00 expands automatically), or drag any slider to start. Color Math accepts HEX, RGB, HSL, and CMYK input simultaneously.

  • Paste directly from your design tool or browser DevTools
  • Shorthand HEX (#abc) expands to full form (#aabbcc) automatically
  • Start with the slider tab that feels most natural to you
02

Explore Formats and Palettes

Switch between the RGB, HSL, and CMYK tabs to adjust via sliders. Scroll down to the Palette panel to see complementary, analogous, and triadic colors generated by Color Math.

  • Click any palette swatch to immediately load that color
  • Use HSL sliders to systematically lighten or darken without changing hue
  • CMYK values give a rough estimate — final print output depends on your printer profile
03

Copy, Save, and Compare

Click any Copy button to grab the format you need. Hit Save Color to add the current shade to your history panel. Color Math retains up to 10 colors across browser sessions.

  • Copy the exact CSS-ready string for HEX, RGB, or HSL
  • Reload the page — saved colors persist via localStorage
  • Click a history swatch to reload a previous color and compare with the palette

Color Math FAQ

Answers to the most common questions about Color Math and color conversion.

What is Color Math and what does it do?

Color Math is a free browser-based tool that converts colors between HEX, RGB, HSL, and CMYK formats in real time. It also generates color palettes (complementary, analogous, triadic) and calculates WCAG 2.1 contrast ratios — all without any server requests.

How accurate is the CMYK conversion?

Color Math uses a standard mathematical conversion formula (RGB → CMYK) which provides a good theoretical estimate. However, real-world print output depends on your specific printer, ink, paper, and ICC color profile. Use Color Math as a starting reference, not a substitute for professional prepress color management.

What does WCAG AA and AAA mean in the contrast checker?

WCAG 2.1 (Web Content Accessibility Guidelines) defines minimum contrast ratios for readable text. AA requires a 4.5:1 ratio for normal text and 3:1 for large text. AAA requires 7:1 for normal text. Color Math calculates these ratios against pure white and pure black so you can choose the right background for your color.

Why does Color Math use HSL instead of HSV or HSB?

HSL (Hue, Saturation, Lightness) maps more intuitively to how CSS defines colors and how designers think about tints and shades. A Lightness of 50% in HSL gives the purest version of a hue, making it easy to generate lighter or darker variants by adjusting a single value.

Does Color Math store my colors anywhere?

Color Math stores your saved colors only in your browser's localStorage — never on any server. The history is local to your device and browser profile. Clearing your browser data will remove it.

How does the palette generator work?

Color Math calculates palette colors using HSL color theory. Complementary colors are 180° opposite on the hue wheel. Analogous colors are ±30°. Triadic colors are +120° and +240°. Saturation and lightness are kept the same as the original color, so the palette feels visually cohesive.

Can I use Color Math on mobile?

Yes. Color Math is fully responsive. Sliders, inputs, and the palette grid all adapt to smaller screens. All calculations happen locally so there is no latency on mobile networks.

Start Your Color Math Now

Convert, compare, and save colors with a tool built for precision. Color Math is free, fast, and works entirely in your browser.

No sign-up required. Works offline after first load.