HEX to RGB Converter
RGB values
rgb(59, 130, 246)
Expanded code: #3B82F6
3B
red → 59
82
green → 130
F6
blue → 246
Paste a HEX code and get its RGB values instantly. Free HEX to RGB converter for 3-digit and 6-digit codes, with a live color preview and one-click copy.
What is HEX to RGB conversion?
HEX to RGB conversion turns a six-digit HEX code into three numbers from 0 to 255. The HEX code #RRGGBB is three two-digit hex pairs in one string — the first pair is red, the second is green, and the third is blue — and the converter reads each pair as a decimal number. The result is the same color written the way code that takes RGB numbers expects it.
Design tools usually show HEX, while canvas code, some CSS functions, and many APIs expect RGB numbers, so this conversion is the bridge between them. The color never changes — only the notation does — and the converter makes the change instantly instead of by hand.
Type a HEX code — the three RGB numbers update live
#3B82F6
3B
→ 59 red
82
→ 130 green
F6
→ 246 blue
Worked example: #FF5733 = rgb(255, 87, 51)
The HEX code #FF5733 converts to rgb(255, 87, 51). Split the code into its three pairs — FF, 57, and 33 — and convert each pair to decimal: FF is 255, 57 is 87, and 33 is 51. Those three numbers are the red, green, and blue channels, in that order.
Check the green pair by hand: 57 means 5 × 16 + 7, which is 80 + 7 = 87. The red pair FF means 15 × 16 + 15, which is 240 + 15 = 255, the brightest a channel can be. The blue pair 33 means 3 × 16 + 3, which is 48 + 3 = 51, a low blue that leaves the color warm and orange.
FF
15 × 16 + 15 = 255
57
5 × 16 + 7 = 87
33
3 × 16 + 3 = 51
Result: rgb(255, 87, 51)
Worked example: #3b5bdb = rgb(59, 91, 219)
The HEX code #3b5bdb converts to rgb(59, 91, 219), and lower-case letters work the same as upper-case. Split it into 3b, 5b, and db: 3b is 3 × 16 + 11 = 59, 5b is 5 × 16 + 11 = 91, and db is 13 × 16 + 11 = 219. The result is a strong indigo blue, with blue as the largest channel by far.
Case does not matter in HEX — #3b5bdb and #3B5BDB are the same color, and the tool accepts both. The tool normalizes the output to upper-case #3B5BDB for the display, but the RGB numbers are identical either way. If you paste a code from a design file in lower case, do not retype it.
#3b5bdb
lower case
#3B5BDB
upper case — same color
Both give rgb(59, 91, 219).
Worked example: #3B82F6 = rgb(59, 130, 246)
The HEX code #3B82F6 converts to rgb(59, 130, 246). Split it into 3B, 82, and F6: 3B is 3 × 16 + 11 = 59, 82 is 8 × 16 + 2 = 130, and F6 is 15 × 16 + 6 = 246. It is a clear medium blue, and it is the same color used as the worked example on the eyedropper and RGB-to-HEX pages, so the three pages agree.
Notice how the three examples together show the whole range. #FF5733 is red-heavy and warm, #3b5bdb is blue-heavy and deep, and #3B82F6 sits between them with a high blue and a medium green. The same three-step split works for all of them, and the tool does it in one step.
3B
3 × 16 + 11 = 59
82
8 × 16 + 2 = 130
F6
15 × 16 + 6 = 246
Result: rgb(59, 130, 246)
How to convert HEX to RGB by hand
To convert HEX to RGB by hand, split the code into three pairs, then convert each pair to decimal. Each pair is two hex digits: multiply the first digit by 16, add the second digit, and remember that A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15. Do that for the red pair, the green pair, and the blue pair, and you have the three RGB numbers.
Take the pair 82 as the example to remember: the first digit 8 times 16 is 128, plus the second digit 2, gives 130. Take the pair F6: the first digit F is 15, times 16 is 240, plus 6, gives 246. Once you can do one pair, you can do all three, because the step never changes.
Hand method for the pair 82
8 × 16
first digit × 16 = 128
+ 2
add the second digit
= 130
green channel
Letter values: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
3-digit shorthand: #RGB expands to #RRGGBB
A 3-digit HEX code expands by doubling each digit: #RGB becomes #RRGGBB. The code #F53 expands to #FF5533, #ABC expands to #AABBCC, and #F00 expands to #FF0000, which is pure red. Each single digit is written twice, so the red, green, and blue channels each get a full pair.
Shorthand only gives 4,096 colors — 16 values per channel, three channels, 16 × 16 × 16 — while full 6-digit codes give 16,777,216. That is why shorthand is fine for simple colors like black (#000), white (#FFF), and red (#F00), but a precise brand color almost always needs all six digits. The tool accepts shorthand and shows the expanded code beside the RGB output.
Each digit doubles in place
#F53
F → FF · 5 → 55 · 3 → 33
#FF5533
#ABC
A → AA · B → BB · C → CC
#AABBCC
#F00
F → FF · 0 → 00 · 0 → 00
#FF0000
Where RGB values are used
RGB values are used wherever code takes three separate numbers instead of one HEX string. Canvas drawing, many JavaScript color APIs, and some CSS functions take rgb(59, 130, 246) directly, and image tools often list a pixel as three numbers. If a tool asks for red, green, and blue separately, this page gives you exactly those three numbers.
The copy button offers both forms for that reason: the full rgb(59, 130, 246) function for pasting into code, and the bare numbers 59, 130, 246 for pasting into three separate fields. Copying the form that matches the target avoids the small error of pasting a function where numbers were expected.
Canvas code line
ctx.fillStyle = "rgb(59, 130, 246)";CSS rgb() function
color: rgb(59, 130, 246);Three separate number fields
59 · 130 · 246
All color tools
21 tools, one topic — see About Hex Color Code Picker for who built this site.
- Color Picker from ImageUpload an image, click a pixel, and read its HEX code.
- Screen EyedropperSample any pixel on your screen.
- RGB to HEX ConverterTurn three RGB numbers into one HEX code.
- HEX to RGB ConverterTurn a HEX code into three RGB numbers.
- HEX to HSL ConverterTurn a HEX code into hue, saturation, and lightness.
- HSL to HEX ConverterTurn HSL values back into a HEX code.
- HEX to HSV ConverterTurn a HEX code into hue, saturation, and value.
- HEX to CMYK ConverterTurn a HEX code into approximate print values.
- RGB to HSL ConverterTurn RGB numbers into hue, saturation, and lightness.
- HEX to OKLCH ConverterTurn a HEX code into the modern OKLCH format.
- Color ConverterSee one color in every format at once.
- HEX to RGBA ConverterTurn a HEX code into RGB with transparency.
- Color Name to HEXLook up any of the 148 CSS named colors.
- Color Palette GeneratorBuild a five-color palette from one color.
- Shades GeneratorBuild 10 tints and 10 shades from one color.
- Gradient GeneratorBuild a linear or radial gradient and copy the CSS.
- Contrast CheckerCheck any text and background pair for AA and AAA.
- Color MixerMix two colors and see the result.
- Random Color GeneratorPick a random color from all 16,777,216 HEX colors.
- Color Blindness SimulatorSee your colors as color-blind users see them.
- Color ChartThe 148 named colors with HEX, RGB, and HSL.
No tool matches your search.
Frequently asked questions
Paste the HEX code and copy the RGB values. Split the code into three pairs — red, green, blue — and each pair becomes a number from 0 to 255. The tool does it live and shows the result as rgb(R, G, B) with a Copy button.
rgb(255, 87, 51). FF is 255, 57 is 87, and 33 is 51. It is a bright coral-orange used for buttons and highlights.
rgb(59, 91, 219). The pairs are 3b = 59, 5b = 91, and db = 219. Lower-case letters work the same as upper-case — #3b5bdb and #3B5BDB are the same color.
rgb(59, 130, 246). The pairs are 3B = 59, 82 = 130, and F6 = 246. It is a clear medium blue used for links and buttons.
Yes — #RGB expands to #RRGGBB by doubling each digit. #F00 becomes #FF0000 (pure red) and #ABC becomes #AABBCC. The tool shows the expanded code beside the RGB output.
Split the code into three pairs, then multiply the first digit of each pair by 16 and add the second digit. A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15. For example, 82 is 8 × 16 + 2 = 130.