Skip to content
ToolZone

HEX to RGB

Convert a HEX color code into its equivalent RGB values, useful when a design tool gives you a HEX code but your code needs RGB instead.

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 HEX to RGB

Paste a HEX code like #10b981 and this converter shows the matching rgb() string, along with HSL and CMYK values, a live preview, WCAG contrast, and tints and shades of the color.

How it works

A six-digit HEX code is split into three pairs: the first two digits are red, the middle two are green, and the last two are blue. Each pair is a base-16 number, where the digits run 0-9 and then a-f for 10-15.

To get the decimal value, multiply the first digit of a pair by 16 and add the second. For #10b981, red is 1x16 + 0 = 16, green is 11x16 + 9 = 185, and blue is 8x16 + 1 = 129, giving rgb(16, 185, 129). The tool does exactly this for each pair and also derives the HSL equivalent from the result.

How to use

  1. 1

    Type or paste a HEX code into the Color field, or click the swatch to choose a color.

  2. 2

    Look at the preview box to check the color.

  3. 3

    Read the RGB row for the converted value.

  4. 4

    Click the copy icon next to RGB to copy the rgb() string.

Worked examples

Emerald green

Converting a green accent for a chart library that expects RGB.

Input
#10b981
Result
rgb(16, 185, 129)

10, b9, and 81 in base 16 are 16, 185, and 129 in decimal.

Pure white

Checking the RGB form of white.

Input
#ffffff
Result
rgb(255, 255, 255)

ff is the largest two-digit hex value, 255, so every channel is at full intensity.

Without the hash

A code copied from a spreadsheet without the #.

Input
ff5733
Result
rgb(255, 87, 51)
Limitations
Eight-digit HEX codes and alpha transparency are not supported. Named colors such as "tomato" aren't recognised.
Assumptions
The HEX code describes an sRGB color, as in CSS. Each channel is 8 bits (0-255).
Privacy
The conversion runs locally in your browser; the color codes you enter are not sent or stored.

Frequently asked questions

Does this support HEX codes with an alpha channel?+

No. Three- and six-digit codes are accepted. Remove the last two digits of an eight-digit code to convert the color, then add transparency in CSS with rgb() and an alpha value.

Why do some HEX codes have only three digits?+

Three-digit HEX is shorthand where each digit is doubled, so #f00 equals #ff0000. You can enter either form here.

Do I need to include the # symbol?+

No. The converter accepts the code with or without the leading #.

Are HEX codes case-sensitive?+

No. #FF5733 and #ff5733 are the same color, and both convert to rgb(255, 87, 51).

Is any color lost when converting HEX to RGB?+

No. Both formats store the same three 0-255 values, so the conversion is exact in both directions.

Related tools