HEX to RGB & HSL Color Converter

Paste any color code to get HEX, RGB, HSL, HSV and CMYK at once. Pick colors straight from your screen and check text contrast.

100% Free Private & Secure Instant Conversion
White 4.84:1 AA Black 4.34:1 AA Large

Formats
HEX#6d5ce7
RGBrgb(109, 92, 231)
HSLhsl(247, 74%, 63%)
HSVhsv(247, 60%, 91%)
CMYKcmyk(53%, 60%, 0%, 9%)

How to Convert HEX to RGB and HSL

Three steps, no signup

1

Enter a Color

Paste a HEX, RGB, HSL or named CSS color, open the swatch picker, or pick a pixel from your screen.

2

Read Every Format

The same color appears as HEX, RGB, HSL, HSV and CMYK, with its contrast against white and black text.

3

Copy the Value

Click Copy next to the format you need and paste it into your stylesheet, design file or code.

HEX, RGB and HSL: One Color, Three Notations

Every color on a web page is stored as amounts of red, green and blue light. HEX, RGB and HSL are just different ways of writing those amounts down. Designers tend to copy HEX codes out of Figma or a screenshot, developers often need rgb() or rgba() for transparency, and HSL is the easiest format to tweak by hand. This converter turns any one of them into all of the others.

It also accepts named CSS colors such as rebeccapurple, short HEX codes such as #fc0, 8-digit HEX with alpha, and modern space-separated syntax like rgb(109 92 231 / 50%). Everything runs in your browser, so nothing you type is sent anywhere.

How HEX to RGB Conversion Works

A six-digit HEX code is three pairs of base-16 digits, one each for red, green and blue. Each pair runs from 00 (0) to FF (255). To convert #6D5CE7 by hand, convert each pair to decimal: 6D = 6 × 16 + 13 = 109, 5C = 92 and E7 = 231. The result is rgb(109, 92, 231). RGB to HEX is the same process in reverse.

When to Use HSL

HSL stands for hue, saturation and lightness. Hue is a position on the color wheel from 0° to 360°, saturation is how vivid the color is, and lightness runs from black (0%) to white (100%). Because those three values match how people think about color, HSL makes it easy to build a palette: keep the hue, then raise or lower lightness for hover states, borders and backgrounds.

Color Format Comparison

FormatExampleBest for
HEX#6D5CE7Design tools, CSS, brand guides
RGB / RGBArgb(109, 92, 231)CSS with transparency, JavaScript, canvas
HSL / HSLAhsl(247, 74%, 63%)Building palettes and tints in CSS
HSV / HSBhsv(247, 60%, 91%)Photoshop and most color pickers
CMYKcmyk(53%, 60%, 0%, 9%)Print previews (approximate)

Grabbing Colors From Screenshots

If you need a color from a screenshot, a website or another app, click Pick from screen in Chrome, Edge or Opera and click the pixel you want. The browser's EyeDropper reads the exact on-screen value and drops it into the converter. It pairs well with a screenshot tool: capture the screen, open the image, then sample the brand colors you need.

Checking Contrast for Accessibility

The two labels on the color preview show the WCAG 2 contrast ratio of white and black text on your color. Normal body text needs at least 4.5:1 to pass AA, large text needs 3:1, and 7:1 passes AAA. Use it to decide whether buttons and badges in that color need light or dark text.

Frequently Asked Questions

Common questions about HEX, RGB and HSL colors

Split the six-digit HEX code into three pairs and convert each pair from base 16 to base 10. For #6D5CE7, 6D is 109, 5C is 92 and E7 is 231, so the RGB value is rgb(109, 92, 231). Paste any HEX code into the converter above and it does this for you instantly.

Convert each RGB channel (0 to 255) to a two-digit base-16 number and join them after a # sign. rgb(255, 128, 0) becomes #FF8000. Type an rgb() value into the converter and copy the HEX output.

All three describe the same sRGB colors. HEX and RGB both list red, green and blue amounts, HEX in base 16 and RGB in base 10. HSL describes the color as hue, saturation and lightness, which is easier to adjust by hand, for example to make a lighter or darker shade.

Yes. In Chrome, Edge and Opera, click Pick from screen and then click any pixel on your screen, including an open screenshot. The color is loaded into the converter with all its formats. Other browsers can use the color swatch picker instead.

Yes. Enter an 8-digit HEX code such as #6D5CE780, an rgba() value or an hsla() value, and the converter keeps the alpha channel in the HEX, RGB and HSL outputs.

It is the WCAG 2 contrast ratio between your color and white or black text. A ratio of 4.5:1 or higher passes AA for normal text, 3:1 passes AA for large text, and 7:1 passes AAA.

More Free Image & Dev Tools

Convert images, data and code in your browser. All free, all private, no signup.

Browse All Tools