Developer tools

HEX to RGB Color Converter (and HSL, HSV, CMYK)

Convert a colour between HEX, RGB, HSL, HSV and CMYK in one step, including transparency. Paste a code in any format or pick a colour, then copy the format you need and check its text contrast.

HEX
#2F5BFF
RGB
rgb(47, 91, 255)
HSL
hsl(227, 100%, 59%)
HSV
hsv(227, 82%, 100%)
CMYK
cmyk(82%, 64%, 0%, 0%)

Contrast for text

White text: 5.17:1AA
Black text: 4.06:1AA large text only

AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1. Contrast is measured on the solid colour.

Everything is converted on your device.

How to use the HEX to RGB Color Converter

  1. Paste a colour in any format, such as #2F5BFF or rgb(47, 91, 255), or use the picker.
  2. Adjust the opacity if you need transparency.
  3. Copy the HEX, RGB, HSL, HSV or CMYK value.

Frequently asked questions

How do I convert HEX to RGB?
Split the six digits into three pairs and read each pair as a number from 0 to 255. For #2F5BFF that's 2F = 47, 5B = 91 and FF = 255, so rgb(47, 91, 255). This tool does it as you type.
What about 8-digit HEX codes?
The last two digits are the opacity (alpha), from 00 (transparent) to FF (solid). #2F5BFF80 is about 50% opaque. Short forms like #abc and #abcd work too.
Why do CMYK values look different in print?
Screen-to-print conversion depends on the printer, ink and paper. The CMYK shown here is a simple mathematical conversion; ask your printer for their colour profile for exact results.
What does the contrast ratio mean?
It measures how readable text is on the colour. Accessibility guidelines (WCAG) ask for at least 4.5:1 for normal text and 3:1 for large text.
Is anything sent anywhere?
No. Conversions happen on your device.