Productive Toolbox

HEX to RGB Converter

Convert HEX color codes to RGB and RGB back to HEX, with the working shown step by step and a chart of common colors.

HEX ⇄ RGB

Result

HEX
#FF5733
RGB (CSS)
rgb(255, 87, 51)
RGB (modern CSS, space-separated)
rgb(255 87 51)
RGB 0–1 (Unity, SwiftUI, OpenGL)
1, 0.341, 0.2
HSL
hsl(11, 100%, 60%)

Need HSV, CMYK or CSS color names? Try the color format converter.

Step by Step: #FF5733 → rgb(255, 87, 51)

Red
FF = 15 × 16 + 15
= 255
Green
57 = 5 × 16 + 7
= 87
Blue
33 = 3 × 16 + 3
= 51

Hex digits A–F stand for 10–15. Going the other way, divide each RGB value by 16: the quotient is the first digit and the remainder the second.

Lighter and Darker Versions

lighter
#FF7F5B
light
#FF6B47
base
#FF5733
dark
#EB431F
darker
#D72F0B
complementary
#00A8CC

How HEX Color Codes Work

A HEX color code is an RGB color written in base 16. The six digits after the # form three pairs, one each for red, green and blue, and each pair runs from 00 (none of that light) to FF (full intensity, 255). That gives 256 × 256 × 256 = 16,777,216 possible colors.

#RRGGBB → rgb(RR, GG, BB)

value = first digit × 16 + second digit  (A=10 … F=15)

#FF5733 → FF = 255, 57 = 87, 33 = 51 → rgb(255, 87, 51)

Hex digits run 0–9 and then A–F:

0 = 0
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Common Colors: HEX to RGB Chart

ColorHEXRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Lime (pure green)#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Cyan / Aqua#00FFFFrgb(0, 255, 255)
Magenta / Fuchsia#FF00FFrgb(255, 0, 255)
Silver#C0C0C0rgb(192, 192, 192)
Gray#808080rgb(128, 128, 128)
Orange#FFA500rgb(255, 165, 0)
Tomato#FF6347rgb(255, 99, 71)
Navy#000080rgb(0, 0, 128)
Teal#008080rgb(0, 128, 128)
Rebecca Purple#663399rgb(102, 51, 153)

In CSS, “green” is #008000; the pure green channel #00FF00 is named “lime”.

Converting RGB Back to HEX

Divide each channel by 16: the whole-number part is the first hex digit and the remainder is the second. For rgb(52, 152, 219):

52 ÷ 16 = 3 remainder 4 → 34

152 ÷ 16 = 9 remainder 8 → 98

219 ÷ 16 = 13 remainder 11 → DB

→ #3498DB

Transparency is not part of RGB. To add it, use the HEX to RGBA converter; for HSV, CMYK or CSS color names, use the color format converter.

How to Use the HEX to RGB Converter

  1. 1Enter a HEX code: Type or paste a 3- or 6-digit HEX code, with or without #, or pick a color with the color picker.
  2. 2Or enter RGB: To go the other way, type three numbers from 0 to 255 such as 255, 87, 51 or rgb(255 87 51), or drag the red, green and blue sliders.
  3. 3Check the working: The step-by-step panel shows how each pair of hex digits becomes a number from 0 to 255.
  4. 4Copy the format you need: Copy HEX, CSS rgb(), the space-separated modern syntax, 0–1 values for Unity or SwiftUI, or HSL.

Frequently Asked Questions

How do I convert HEX to RGB?

Split the six digits into three pairs for red, green and blue, and convert each pair from base 16: first digit × 16 + second digit, where A–F mean 10–15. For #FF5733: FF = 15 × 16 + 15 = 255, 57 = 5 × 16 + 7 = 87 and 33 = 3 × 16 + 3 = 51, so rgb(255, 87, 51).

How do I convert RGB to HEX?

Divide each value by 16. The whole-number result is the first hex digit and the remainder the second. For 87: 87 ÷ 16 = 5 remainder 7, so 57. Put the three pairs after a #: rgb(255, 87, 51) is #FF5733.

What does a 3-digit HEX code like #F53 mean?

It is shorthand in which every digit is doubled, so #F53 is #FF5533 and #FFF is #FFFFFF (white). Only colors whose pairs repeat a digit can be written this way.

What about 8-digit HEX codes like #FF573380?

The last two digits are transparency (alpha), which plain RGB cannot store. This converter uses the first six digits; use the HEX to RGBA converter to keep the transparency as rgba().

How do I get RGB values between 0 and 1?

Divide each value by 255. rgb(255, 87, 51) becomes 1, 0.341, 0.2. Unity, SwiftUI, OpenGL, Blender and most shader code use this 0–1 form, and the converter shows it ready to copy.

Is HEX or RGB better for CSS?

They describe exactly the same colors, and browsers treat them identically. HEX is shorter and common in design handoffs; rgb() is easier to read and to adjust one channel at a time.