Boneyard Tools

HEX and RGB color notation explained

How hexadecimal color codes map to red, green and blue channels, why shorthand works, and when to reach for RGB over HEX in CSS.

How a HEX code stores a color

A HEX color packs three color channels into six hexadecimal digits. The first pair is red, the second is green and the third is blue, and each pair ranges from 00 to ff. Because hexadecimal is base sixteen, two digits cover 256 distinct levels, exactly the 0 to 255 range each RGB channel uses. Reading #3b82f6 that way, 3b is 59 red, 82 is 130 green and f6 is 246 blue, which is why the converter returns rgb(59, 130, 246).

Why shorthand codes work

Three-digit HEX such as #f00 is a compact form where each single digit is repeated to make a pair. So f becomes ff, 0 becomes 00, and #f00 expands to #ff0000. Shorthand can only represent colors whose pairs are made of matching digits, so #ff0000 has a shorthand but #ff0102 does not. The tool always expands shorthand before converting, which is why both forms of red land on rgb(255, 0, 0).

HEX versus RGB in practice

HEX and RGB describe the same colors, so the choice is about readability and features. HEX is compact and common in design handoffs and CSS variables. RGB spells out each channel as a number, which is easier to tweak programmatically or animate, and it extends cleanly to rgba() when you need transparency. Many teams store a HEX palette and convert to RGB only when a specific channel or an alpha value is needed.

Common conversions to remember

A handful of values show up constantly, so they are worth memorizing. Black is #000000 or rgb(0, 0, 0), and white is #ffffff or rgb(255, 255, 255). Full-strength primaries are #ff0000 red, #00ff00 green and #0000ff blue. Mid gray sits around #808080 or rgb(128, 128, 128). Recognizing these at a glance helps you sanity-check a converted value before pasting it into a stylesheet.

Frequently asked questions

Is HEX case sensitive?

No. #FF0000 and #ff0000 are identical because hexadecimal digits a through f mean the same value in upper or lower case. This tool reads either and the letters in your output follow a consistent style.

Why do some editors show eight-digit HEX codes?

An eight-digit HEX code adds a fourth pair for alpha, the opacity channel. This converter handles the six-digit opaque form, so drop the final alpha pair or use rgba() when you need transparency.