HEX to RGB Converter

Type a hex code such as #1E90FF, 1E90FF or #39F.

HEX → RGB
#1E90FFdodgerblue
HEX#1E90FF
RGBrgb(30, 144, 255)
HSLhsl(210, 100%, 56%)
HSV / HSBhsv(210, 88%, 100%)
CMYKcmyk(88%, 44%, 0%, 0%)
OKLCHoklch(65.2% 0.19 253.2)

Contrast

Aa
3.24:1on white
AAAA largeAAA
Aa
6.49:1on black
AAAA largeAAA

Nearest CSS name

dodgerblue#1E90FFDetails →

Code

Tailwindbg-[#1e90ff]
SwiftUIColor(red: 0.118, green: 0.565, blue: 1)
AndroidColor.parseColor("#1E90FF")
FlutterColor(0xFF1E90FF)

How do you convert HEX to RGB?

Split the six hex digits into three pairs (red, green, blue) and convert each pair from base 16 to base 10: multiply the first digit by 16 and add the second. Hex digits A to F stand for 10 to 15. Each result is a value from 0 to 255.

Example: #1E90FF

ChannelHex pairCalculationDecimal
Red1E1 × 16 + 1430
Green909 × 16 + 0144
BlueFF15 × 16 + 15255

So #1E90FF = rgb(30, 144, 255).

What is the HEX to RGB formula?

R = 16 × d1 + d2, using the 1st and 2nd hex digits
G = 16 × d3 + d4
B = 16 × d5 + d6

How do you convert HEX to RGBA?

An 8-digit hex code such as #1E90FF80 adds a fourth pair for alpha. Convert it like the others and divide by 255: 80 hex = 128, and 128 / 255 ≈ 0.5, so the color is rgba(30, 144, 255, 0.5). A 6-digit code is fully opaque (alpha 1). The 8-digit form is defined in W3C, CSS Color Module Level 4 and works in all current browsers.

What about 3-digit hex codes?

Shorthand codes repeat each digit: #39F means #3399FF, which is rgb(51, 153, 255). A 4-digit code such as #39F8 adds a shorthand alpha digit.

How do I convert HEX to RGB in JavaScript, Python or CSS?

// JavaScript
const hex = "1E90FF";
const [r, g, b] = [0, 2, 4].map(i => parseInt(hex.slice(i, i + 2), 16)); // 30, 144, 255

# Python
h = "1E90FF"
r, g, b = (int(h[i:i + 2], 16) for i in (0, 2, 4))  # 30, 144, 255

In CSS you rarely need to convert at all: color: #1E90FF and color: rgb(30 144 255) are the same color. For transparency use rgb(30 144 255 / 50%) or the 8-digit hex form.

Common hex colors in RGB

HEXRGBCMYKName
#FFFFFF255, 255, 2550, 0, 0, 0white
#0000000, 0, 00, 0, 0, 100black
#FF0000255, 0, 00, 100, 100, 0red
#00FF000, 255, 0100, 0, 100, 0lime
#0000FF0, 0, 255100, 100, 0, 0blue
#FFFF00255, 255, 00, 0, 100, 0yellow
#00FFFF0, 255, 255100, 0, 0, 0aqua
#FF00FF255, 0, 2550, 100, 0, 0fuchsia
#808080128, 128, 1280, 0, 0, 50gray
#FFA500255, 165, 00, 35, 100, 0orange
#800080128, 0, 1280, 100, 0, 50purple
#0080800, 128, 128100, 0, 0, 50teal
#1E90FF30, 144, 25588, 44, 0, 0dodgerblue
#2E8B5746, 139, 8767, 0, 37, 45seagreen
#FF5733255, 87, 510, 66, 80, 0

Formulas checked October 2026 against W3C, CSS Color Module Level 4.

Color names

All color names →

Frequently asked questions

What is #FFFFFF in RGB?

#FFFFFF is rgb(255, 255, 255), pure white.

How do I convert hex to RGBA?

Use an 8-digit hex code. The last two digits are the alpha: convert them to decimal and divide by 255. #1E90FF80 is rgba(30, 144, 255, 0.5).

Is the # needed in a hex code?

In CSS, yes. In this converter you can leave it out: 1E90FF and #1E90FF give the same result.

What does each pair in a hex code mean?

The first pair is red, the second green and the third blue. Each pair ranges from 00 (0) to FF (255).