Skip to content
ToolZone

Color Converter

Convert a color value between HEX, RGB, and HSL formats, useful for developers and designers working across tools that expect different formats.

Runs in your browser. Nothing you enter or upload leaves your device.

HEX
#2563EB
RGB
rgb(37, 99, 235)
HSL
hsl(221, 83%, 53%)
CMYK
cmyk(84%, 58%, 0%, 8%)

Contrast (WCAG)

Aa
On white: 5.17:1
✓ AA✗ AAA✓ AA large
Aa
On black: 4.06:1
✗ AA✗ AAA✓ AA large

Tints and shades

Color harmonies

Complementary
Analogous
Triadic

Click any swatch to select it.

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the Color Converter

This Color Converter takes a six-digit HEX color, from typing or from a color picker, and shows the same color as CSS rgb() and hsl() values next to a large preview. It is built for front-end developers and designers who move between design files and stylesheets.

How it works

A six-digit HEX code is three pairs of base-16 digits, one each for red, green, and blue. The converter reads each pair as a number from 0 to 255, so #2563eb becomes red 37, green 99, and blue 235, written as rgb(37, 99, 235).

For HSL, the RGB values are scaled to 0-1. Lightness is the average of the largest and smallest channel. Saturation depends on the difference between those two channels relative to lightness, and hue is calculated from which channel is largest and how the other two compare, giving an angle on the color wheel. Hue is rounded to whole degrees, and saturation and lightness to whole percentages.

How to use

  1. 1

    Type a six-digit code into the HEX field, such as #2563eb, or click the color swatch to open your browser's color picker.

  2. 2

    Check the large preview box to confirm the color.

  3. 3

    Read the HEX, RGB, and HSL rows below the preview.

  4. 4

    Click the copy icon next to the format you need.

Worked examples

A blue brand color

Converting the default color for use in a CSS variable.

Input
#2563eb
Result
rgb(37, 99, 235) hsl(221, 83%, 53%)

An orange accent

Getting HSL values so you can create a lighter tint.

Input
#ff5733
Result
rgb(255, 87, 51) hsl(11, 100%, 60%)

Raising the lightness to 75% in hsl() gives a softer tint of the same hue.

A neutral gray

Checking a mid-gray from a style guide.

Input
#808080
Result
rgb(128, 128, 128) hsl(0, 0%, 50%)

Grays have equal red, green, and blue, so saturation is 0% and hue has no effect.

Limitations
Only six-digit HEX input is accepted; three-digit shorthand and eight-digit codes with alpha show as Invalid. There are no separate RGB or HSL input fields; start from a HEX code or the color picker. HSL output is rounded to whole numbers, which can shift a color slightly when converted back.
Assumptions
Colors are in the standard sRGB space used by CSS. The HEX code has no alpha channel.
Privacy
All conversions run in your browser, and no color values are sent or stored.

Frequently asked questions

What's the difference between RGB and HSL?+

RGB defines a color by its red, green, and blue components, while HSL uses hue, saturation, and lightness. HSL is often easier when you want a lighter, darker, or more muted version of a color.

Which format should I use in my CSS?+

All three are valid in modern CSS. HEX is compact, rgb() is convenient when you add transparency, and hsl() is easiest for building shades. Pick the one that suits the edit you are making.

Can I enter a three-digit HEX code?+

Not directly. Expand it first by doubling each digit, so #0af becomes #00aaff, and the converter will read it.

Why does the result say Invalid?+

The HEX field must contain exactly six hexadecimal digits (0-9, a-f), with or without a leading #. Extra characters, a missing digit, or an alpha channel make it invalid.

Is the conversion exact?+

The RGB values are exact. HSL values are rounded to whole degrees and percentages, so they are very close but may differ by a fraction from the precise value.

Related tools