Hex to RGB Converter

Paste a hex color code to get its RGB values, or enter RGB values to get the hex code. The conversion happens instantly as you type, and you can copy either format with one click.

Hex → RGB

rgb(45, 106, 79)

RGB → Hex

#2d6a4f
Once you have your color, generate its full range of tints and shades with the free HexTints generator, or look it up in the color library for precomputed values and WCAG contrast notes.

How Hex to RGB Conversion Works

A hex color code is just RGB written in base 16. The six characters after the # are three two-digit pairs: the first pair is the red channel, the second is green, and the third is blue. Each pair runs from 00 (0) to FF (255) — the letters A–F stand for the values 10–15.

To convert a pair by hand, multiply the first digit's value by 16 and add the second digit's value.

Worked Example: #2D6A4F

#2D6A4F
 ├─ 2D → (2 × 16) + 13 =  45  (red)
 ├─ 6A → (6 × 16) + 10 = 106  (green)
 └─ 4F → (4 × 16) + 15 =  79  (blue)

Result: rgb(45, 106, 79)

Going the other way (RGB → hex), divide each value by 16: the quotient is the first hex digit and the remainder is the second. 45 ÷ 16 = 2 remainder 13, and 13 is D, so 45 becomes 2D.

Common Colors as Hex and RGB

ColorHexRGB
Red#FF0000rgb(255, 0, 0)
Green#008000rgb(0, 128, 0)
Blue#0000FFrgb(0, 0, 255)
Orange#FFA500rgb(255, 165, 0)
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)

Three-digit shorthand hex codes work too: each digit is doubled, so #fa3 means #ffaa33. The converter above accepts both forms.

Frequently Asked Questions

Want to go beyond conversion? Start from your hex code on the HexTints homepage to build complete palettes, or read up on how tints and shades work.