Free Color Converter — HEX, RGB, HSL & OKLCH

Convert any color between HEX, RGB, HSL, and OKLCH instantly. Edit with sliders, sample from your screen, and copy CSS-ready values with one click. No signup required.

#

#3B82F6

rgb(59, 130, 246)

On White

AA Large

On Black

AA

Quick Presets

Edit by Component

R
59
G
130
B
246

Color Values

HEX

Web / CSS

#3B82F6

RGB

CSS / Canvas

59, 130, 246

HSL

CSS / Design

217°, 91%, 60%

OKLCH

CSS Level 4

0.623 0.188 259.8°

CSS HEX

CSS property

color: #3B82F6;

CSS RGB

CSS property

color: rgb(59, 130, 246);

CSS HSL

CSS property

color: hsl(217, 91%, 60%);

CSS OKLCH

CSS property

color: oklch(0.623 0.188 259.8);

CSS Variable

Design token

--color-primary: #3B82F6;

Tailwind Arbitrary

Tailwind CSS

bg-[#3B82F6]

More Free Design & Color Tools

Introduction

Color Converter — What It Does and Why You Need It

A color converter translates color values between formats instantly — HEX, RGB, HSL, and OKLCH — so you never have to do the math manually.

Every design tool, browser, and CSS spec speaks a slightly different color language. This tool bridges the gap, giving you every format in one place with one-click copying.

HEX#3B82F6
RGBrgb(59, 130, 246)
HSLhsl(217, 91%, 60%)
OKLCHoklch(0.623 0.214 259.8)

Understanding Color Formats

Each format has a purpose. Knowing when to use which one makes you a faster, more intentional developer.

HEX

The most common format on the web. A six-character string like #3B82F6 represents red, green, and blue channels in base-16.

Use HEX when copying colors from design tools like Figma, writing static CSS, or working with older codebases. It is compact and universally supported.

RGB

RGB expresses colors as three integers from 0 to 255. rgb(59, 130, 246) is the same blue as the HEX above.

Use RGB when working with Canvas API, WebGL, or when you need to manipulate individual color channels programmatically in JavaScript.

HSL

HSL stands for Hue, Saturation, Lightness. It describes color in a way that maps to human perception — hue is the angle on the color wheel, saturation controls intensity, lightness controls brightness.

Use HSL when building theme systems. Adjusting only the lightness value lets you create tints and shades while keeping the hue consistent.

OKLCH

OKLCH is the modern CSS Level 4 color format. It is perceptually uniform — meaning a change of 10 in lightness looks the same regardless of the hue, unlike HSL.

Use OKLCH for design systems where consistency of perceived brightness matters, or when targeting wide-gamut displays. Supported in all modern browsers.

When to Use Each Format

Copying from Figma or Sketch

HEX

Writing static CSS for a landing page

HEX or HSL

Manipulating colors in JavaScript / Canvas

RGB

Building a theme with tints and shades

HSL

Targeting wide-gamut displays (P3)

OKLCH

Modern design system with perceptual consistency

OKLCH

Sharing a color spec with a developer

HEX

Animating color transitions in CSS

HSL or OKLCH

How Color Conversion Works

All conversions route through RGB as the intermediate format. HEX is just a hexadecimal encoding of the same three 0–255 integers. HSL is derived by computing the min, max, and delta of the RGB channels and mapping them to a hue angle, saturation ratio, and lightness percentage.

OKLCH conversion is more involved. RGB values are first linearized (gamma-decoded), then transformed to XYZ-D65 color space, then to OKLab via a matrix multiply, and finally to OKLCH by converting the a/b components to polar form (chroma and hue angle).

This tool performs all conversions client-side in the browser — no server, no latency, no data sent anywhere.

Frequently Asked Questions

Is HEX the same as RGB?

Yes, HEX is just RGB written in hexadecimal. #3B82F6 and rgb(59, 130, 246) represent the exact same color. HEX is more compact for writing in CSS; RGB is easier to manipulate numerically in code.

Why does my HSL conversion look slightly off?

HSL rounds hue to the nearest degree and saturation/lightness to the nearest percent. This rounding means a round-trip conversion (HEX → HSL → HEX) may produce a value 1–2 digits away from the original. The visual difference is imperceptible.

Which browsers support OKLCH in CSS?

All modern browsers support OKLCH as of 2023 — Chrome, Firefox, Safari, and Edge. For older browser support, provide a HEX or RGB fallback using the CSS cascade.

What is the EyeDropper button?

The EyeDropper lets you sample any color visible on your screen — from another browser tab, a design file, or a reference image. It uses the native browser EyeDropper API, currently available in Chrome and Edge.

Can I input RGB, HSL, or OKLCH directly?

Currently the tool accepts HEX input, with RGB and HSL editable via the component sliders. Direct text input for all formats is on the roadmap.

Fast, Accurate, Free

No sign-up, no rate limits, no tracking. Paste a HEX code, pick a color, or sample from your screen — and get every format you need in seconds.

The Color Converter is one of several free color tools on Pacgie, alongside the Color Palette Generator, Contrast Checker, and Gradient Generator.