How hex color codes work
A CSS hex color starts with # followed by the red, green, and blue channels encoded in hexadecimal. The usual form is #RRGGBB: two digits for red, two for green, and two for blue. Each pair ranges from 00 (none of that channel) to FF (full intensity), because two hex digits represent 8 bits (256 steps). In JavaScript, parseInt("FF", 16) yields 255.
RGB color model
RGB is an additive color model: red, green, and blue light are combined. Each channel is typically stored as an integer from 0 to 255 (one byte). Equal R, G, and B give a neutral gray; rgb(0,0,0) is black and rgb(255,255,255) is white. This matches what hex encodes, just written in decimal instead of base-16 pairs.
Shorthand hex
When each channel repeats the same nybble, CSS allows three-digit hex: #RGB expands to #RRGGBB. For example, #FFF is the same as #FFFFFF, and #39C equals #3399CC. This converter accepts both forms in the hex field.
Hex vs RGB usage
In CSS, you will see both #1e40af and rgb(30, 64, 175); they describe the same sRGB color. Design tools (Figma, Sketch, browsers’ devtools) often let you edit either representation and copy one format for the other. Hex is compact and easy to scan; RGB can be simpler when you are tweaking one channel with the keyboard.