A hex code is a short string that tells a screen exactly which color to display. It starts with a hash and uses six characters, like #1BB1ED. Behind the scenes those six characters are three pairs: one for red, one for green, and one for blue, each running from 00 (none) to FF (full). Mix those three amounts and you get any color a screen can show.
Think of it as a precise paint recipe. Saying a brand color is light blue is vague, but #1BB1ED is exact, so a developer in one country and a printer in another land on the identical shade. That precision is why hex codes anchor brand guidelines and feed straight into design tokens. They are simply a compact way of writing an RGB value, which is what the screen actually uses.
Why hexadecimal and not plain numbers? Because each pair runs from 00 to FF, which is base-16 counting where the digits go past 9 into A through F. FF equals 255, the highest a single color channel goes. That is also why pure black is #000000 and pure white is #FFFFFF.
There is a handy shorthand too. A three-character code like #FFF expands to #FFFFFF, and #1BE would become #11BBEE, so some designers use it for simple values. But be careful with manual edits: one wrong character shifts the color, and #1BB1ED versus #1BB1 ED with a stray space silently breaks.
Hex is built for screens, not paper. For print you usually convert to a different system, since ink mixes color differently than light does. But for anything shown on a display, the hex code is the standard you copy, share, and reuse.
At TopDevs we lock brand colors to exact hex values early and store them as tokens, so every page and component renders the same shade with no drift.