Hex to RGB Color Converter

Direction
Preview
RGBrgb(255, 136, 0)
R255
G136
B0

This color converter translates between hex codes and RGB triplets in both directions. A hex code packs three color channels into six hexadecimal digits, two per channel, where each pair ranges from 00 to FF (0 to 255 in decimal). Paste a code such as #FF8800 to read off its red, green, and blue values, or enter three 0-255 numbers to build the matching hex code for CSS, design tools, or markup.

Formula

R = hex[0:2]16, G = hex[2:4]16, B = hex[4:6]16 (and the inverse)

R
Red channel, 0-255
G
Green channel, 0-255
B
Blue channel, 0-255
16
Value read as a base-16 (hexadecimal) number

How it works

  1. Pick a direction: Hex to RGB to decode a color code, or RGB to Hex to assemble one from channel numbers.
  2. For hex input, the tool strips any leading # and expands 3-digit shorthand (#abc becomes #aabbcc) before reading each two-digit pair as a base-16 number from 0 to 255.
  3. For RGB input, each 0-255 channel is converted to a two-digit hexadecimal value and the three are joined into a #RRGGBB string. A live swatch previews the resulting color.

Worked example

Decode the hex color #FF8800 into RGB channels.

  1. FF in base 16 = 15x16 + 15 = 255 (red).
  2. 88 in base 16 = 8x16 + 8 = 136 (green).
  3. 00 in base 16 = 0 (blue).

rgb(255, 136, 0) — R 255, G 136, B 0.

Frequently asked questions

Does it support 3-digit shorthand hex codes?
Yes. A shorthand code like #abc is expanded by doubling each digit to #aabbcc before conversion, so #abc decodes to rgb(170, 187, 204). Both 3- and 6-digit forms are accepted with or without the leading hash.
What range are the RGB values?
Each of the red, green, and blue channels runs from 0 to 255, which corresponds to the hexadecimal range 00 to FF. Entering a value outside 0-255 is rejected as invalid.
Why does my hex code show in uppercase?
Hex letters A-F are case-insensitive, so #ff8800 and #FF8800 are the same color. The converter normalizes output to uppercase for consistency, but you can type either case as input.
Does this handle alpha or opacity (8-digit hex)?
No. This tool converts solid RGB colors only, using 3- or 6-digit hex. Eight-digit codes that include an alpha channel are not supported, so drop the final two digits before converting.