Skip to content
SmaftyTools

Color Converter

Convert colors between HEX and RGB with a live picker and instant preview. Free online color converter for designers and developers.

About Color Converter

The Color Converter is a free online color converter that keeps HEX, RGB and HSL in sync — change any one of them and the other two, plus a live swatch, update immediately. Type a value directly, or pick visually with the built-in color picker; the tool also runs a hex to rgb and rgb to hex conversion automatically as you type, so you never have to do the arithmetic by hand.

HEX (#3b82f6) is the compact format used in CSS and design handoffs, RGB (rgb(59, 130, 246)) is what canvas APIs and many image libraries expect, and HSL (hsl(217, 91%, 60%)) describes a color by hue, saturation and lightness — the format designers reach for when they want to nudge a color lighter, darker or more saturated without changing its hue. Converting between all three by hand is tedious and easy to get wrong; this tool makes it a copy-paste job while showing the actual rendered color so you can confirm it's right before it goes into code.

Below the converter sits a built-in WCAG contrast checker: it computes the contrast ratio of your current color against pure white and pure black text (and vice versa), using the same relative-luminance formula from the WCAG 2.x spec, and labels each result AAA, AA or Fail. That's directly useful for accessibility work — picking a background color and immediately seeing whether white or black text will actually be legible on it, without switching to a separate contrast tool.

Every calculation — the HEX/RGB/HSL conversion and the contrast math — runs locally in JavaScript in your browser as you type, so there's no lag waiting on a server and no color values are ever transmitted anywhere. One thing to note: the color picker and swatch preview are HEX-based, so entering an out-of-range HSL or RGB value (like a saturation over 100%) will show a validation message rather than silently clamping it.

How to Use the Color Converter

  1. Enter a HEX code (like #ff6600), RGB values, or HSL values — or use the visual color picker.
  2. Watch the other two formats and the live swatch update instantly.
  3. Scroll to the WCAG contrast section to see the ratio and pass/fail rating against white and black text.
  4. Click Copy next to the format you need.

Features

  • Three-way HEX ↔ RGB ↔ HSL conversion
  • Visual color picker with live preview swatch
  • Accepts shorthand HEX (#f60) and full form
  • Built-in WCAG contrast checker against white and black, with AA/AAA ratings
  • One-click copy in any format

Examples

Converting a brand blue

Input

#3b82f6

Output

rgb(59, 130, 246) / hsl(217, 91%, 60%)

Contrast against white

Input

#3b82f6 text on a #ffffff background

Output

3.68:1 — fails AA for normal text (needs 4.5:1)

Contrast against black

Input

#3b82f6 text on a #000000 background

Output

5.71:1 — passes AA, fails AAA (needs 7:1)

Frequently Asked Questions

What is the difference between HEX, RGB and HSL?

They describe the same color three different ways. HEX packs red, green and blue into hexadecimal pairs (#RRGGBB); RGB lists the same channels as decimal numbers from 0–255; HSL instead describes hue (0–360°), saturation and lightness (both 0–100%), which is often more intuitive for adjusting a color's tone.

What do the six HEX digits mean?

Each pair is one channel in hexadecimal: the first two digits are red, the middle two green, the last two blue. 00 means none of that channel; ff means full intensity.

What do the AA and AAA contrast ratings mean, and when do I need them?

They're WCAG accessibility thresholds for text-to-background contrast. AA (the baseline most sites target, and often a legal requirement) needs a ratio of at least 4.5:1 for normal text; AAA is stricter at 7:1. Use this checker whenever you're picking a text color over a colored background to confirm it stays readable for users with low vision.

Is the Color Converter free?

Yes, the Color Converter is completely free with no usage limits. No signup, no account and no installation required.

Does the converter work on mobile?

Yes. The converter is fully responsive and works in any modern browser on phones, tablets and desktops.