Find your next tool

Browse tools or search by task

Explore JSONToonPro

Color Tools

HEX to RGB Converter – Convert Hex Color to RGB

Convert HEX color codes to RGB values online. Supports 3- and 6-digit hex, optional alpha and instant CSS-ready output.

Runs locally in your browser. Nothing you paste is uploaded.

HEX to RGB workspace

Enter 3, 4, 6 or 8 hex digits, optionally starting with #. Four and eight digits include alpha.

Alpha100%
Click to pick
HEX#2563EB
RGBrgb(37, 99, 235)
HSLhsl(221, 83%, 53%)

RGB channels

Red37
Green99
Blue235

HSL channels

Hue221deg
Saturation83%
Lightness53%

How to Convert HEX to RGB

Enter a HEX color and read its red, green and blue channels. Each pair is interpreted as a base-16 byte. Copy the CSS-ready RGB value and check the swatch before replacing a stylesheet value.

3-Digit vs 6-Digit HEX Colors

Three-digit HEX duplicates each digit: #abc expands to #aabbcc. Six-digit HEX explicitly provides two digits per channel. Four- and eight-digit forms also carry alpha when supported by the tool.

RGB Channels and Alpha Values

RGB channels use integers from 0 to 255. Alpha is independent and ranges from fully transparent to fully opaque. In eight-digit HEX the final pair represents opacity, not a fourth color channel.

HEX to RGB Examples

#FF8000 becomes rgb(255, 128, 0). #fff expands to #ffffff and becomes white. Keeping leading zeroes is essential for correct channel grouping in a six-digit code.

Using RGB in CSS

Use RGB when channel values or alpha are convenient in your stylesheet. A transparent color blends with the background, so validate its appearance in context rather than judging the isolated swatch.

More examples and technical details

How to Convert HEX to RGB by Hand

A HEX color code looks cryptic at first, but it is just three numbers wearing a disguise. The hash is decoration, and the six characters after it are three pairs of hex digits, one pair each for red, green, and blue. Converting to RGB means turning each pair from base 16 back into an ordinary decimal number between 0 and 255.

The routine is short:

  1. Drop the leading hash and take the six remaining characters.
  2. Split them into three pairs: the first pair is red, the second green, the third blue.
  3. Convert each pair from base 16 to decimal. The left digit counts sixteens, the right digit counts ones.
  4. Write the three results as rgb(red, green, blue).

Worked example: #FF5733

Split into FF, 57, 33 and convert each pair:

FF = (15 x 16) + 15 = 255
57 = (5 x 16) + 7 = 87
33 = (3 x 16) + 3 = 51
Result: rgb(255, 87, 51)

The letters A through F simply stand for 10 through 15, so F is 15 and FF works out to (15 x 16) + 15 = 255, the maximum any channel can reach.

Shorthand Three Digit HEX

You will often see three digit HEX codes like #F53. This is a shorthand that CSS expands by doubling every digit, so #F53 becomes #FF5533. The shorthand only works when both digits of each pair are identical, which is why it can only express 4,096 of the 16 million possible colors. When you convert a three digit code, expand it first, then treat it exactly like a normal six digit code.

#F53 expands to #FF5533
FF = 255, 55 = 85, 33 = 51
Result: rgb(255, 85, 51)

Where You Actually Need RGB

If HEX is so compact, why convert at all? Because plenty of contexts want the raw channel numbers. CSS rgba() is the classic case: to fade a color to fifty percent opacity you need rgba(255, 87, 51, 0.5), and there is no way to add that alpha to a plain HEX color without switching notations. The HTML canvas API expects RGB style strings for its fillStyle and strokeStyle. SVG attributes, WebGL, and most image manipulation code all work in RGB because the individual numbers are what the math operates on. Whenever you need to reason about or animate a single channel, RGB is the format that gives you direct access to it.

Named Color Reference

CSS ships with a set of keyword colors you can write by name instead of a code. They map to exact HEX and RGB values, so the table below is handy when you want to sanity check a conversion or reach for a familiar color without opening a picker.

NameHEXRGB
black#000000rgb(0, 0, 0)
white#FFFFFFrgb(255, 255, 255)
red#FF0000rgb(255, 0, 0)
green#008000rgb(0, 128, 0)
blue#0000FFrgb(0, 0, 255)
yellow#FFFF00rgb(255, 255, 0)
cyan#00FFFFrgb(0, 255, 255)
magenta#FF00FFrgb(255, 0, 255)
silver#C0C0C0rgb(192, 192, 192)
gray#808080rgb(128, 128, 128)
orange#FFA500rgb(255, 165, 0)
purple#800080rgb(128, 0, 128)
teal#008080rgb(0, 128, 128)
navy#000080rgb(0, 0, 128)

Need a different color task? Browse every free developer tool including color converters, encoders, and hashing utilities.

Frequently asked questions

How do I convert a HEX color to RGB?

Read each hexadecimal pair as a byte, or enter the code here for the RGB output.

Does #fff equal #ffffff?

Yes. Each shorthand digit is repeated, so both represent white.

Can HEX include alpha transparency?

Yes. Four- and eight-digit forms append alpha information.

What RGB range is valid?

Each red, green and blue channel ranges from 0 to 255.

Is conversion client-side?

Yes. Color conversion runs in the browser.