Skip to content
Utilfinch

Color Converter

Type a color in HEX, RGB or HSL and see it in all three formats, with a live swatch and a contrast check for readable text.

Type a HEX code (#3B82F6), rgb(59, 130, 246) or hsl(217, 91%, 60%).

#3B82F6
  • HEX

    #3B82F6

  • RGB

    rgb(59, 130, 246)

  • HSL

    hsl(217, 91%, 60%)

Contrast: 3.68:1 with white text, 5.71:1 with black text. Body text should reach at least 4.5:1.

Everything is calculated in your browser.

How to use Color Converter

  1. Enter a color

    Type a HEX code such as #1e40af, an rgb() value or an hsl() value. You can also click the color picker to choose one visually.

  2. See every format

    The tool shows the same color as HEX, RGB and HSL next to a swatch, and tells you if the text you typed could not be read as a color.

  3. Copy and check contrast

    Press Copy beside the format you need. The contrast ratios show how readable white or black text would be on that color.

Example

One color in three formats

Input

#1e40af

Result

  • HEX: #1e40af
  • RGB: rgb(30, 64, 175)
  • HSL: hsl(226, 71%, 40%)

Common uses

  • Web design and CSS

    Switch between the formats your stylesheet, design tool and brand guide use, without doing the maths by hand.

  • Accessibility checks

    See whether white or black text meets the recommended contrast on a button or banner color before you ship it.

  • Building a palette

    Take a HEX code from a logo, convert it to HSL, and then adjust lightness or saturation to create matching shades.

  • Matching colors across tools

    Move a color from one app that shows RGB to another that wants HEX, and be sure both show the same shade.

Tips for better results

  • WCAG recommends a contrast ratio of at least 4.5 to 1 for normal text and 3 to 1 for large text. Aim higher for small body copy.
  • Short HEX codes such as #fc0 are accepted and expanded to six digits, so #fc0 means #ffcc00.
  • HSL is often the easiest format for making variations. Keep the hue, then raise or lower the lightness for lighter or darker shades.
  • Screens differ, so a color can look slightly different on another display even when the numbers are identical.

Frequently asked questions

What is the difference between HEX, RGB and HSL?

They describe the same colors in different ways. HEX and RGB mix red, green and blue light, while HSL describes a color by its hue, saturation and lightness.

What does the contrast ratio tell me?

It compares the brightness of two colors on a scale from 1 to 21. A higher ratio makes text easier to read, and accessibility guidelines set minimum values.

Which formats can I type in?

HEX with three or six digits, rgb() with three numbers from 0 to 255, and hsl() with a hue and two percentages. The leading hash in HEX is optional.

Does it support transparency?

Not at the moment. The tool converts solid colors, so alpha values in rgba() or eight-digit HEX codes are not read.

Last updated: