Blog · Design tools

How hex colour codes work (and how to read one)

A hex colour code is six hexadecimal digits in three pairs, #RRGGBB, where each pair sets how much red, green and blue light to mix, from 00 (none) to FF (full). #FF0000 is pure red, #FFFFFF is white and #000000 is black.

Title card reading “How hex colour codes work” beside a screenshot of the Digital Sauce hex to RGB converter with #EF466F typed over a large pink swatch and its RGB value beside it.

Hex codes look cryptic, but they are just RGB numbers written in base 16. Once you know the pattern you can guess a colour from its code. To convert any code instantly, use our free hex to RGB converter.

What does #RRGGBB mean?

The # says "this is a hex colour". Then come three pairs: RR for red, GG for green and BB for blue. Each digit is 0 to 9 or A to F, where A is 10 and F is 15, so each pair goes from 00 (0) to FF (255) (MDN: hex-color).

With 256 levels for each of three channels, there are 256 × 256 × 256 = 16,777,216 possible six-digit hex colours.

How to convert a hex pair to a number

Multiply the first digit by 16 and add the second. For #EF466F:

PairMathsValue
EF (red)14 × 16 + 15239
46 (green)4 × 16 + 670
6F (blue)6 × 16 + 15111

So #EF466F = rgb(239, 70, 111): lots of red, a little blue, not much green. That is a warm pink, the Digital Sauce brand colour.

Each pair is one channel: first digit × 16 plus the second. The bars show each channel out of 255, lit in its own colour.

How to guess a colour from its code

  • The biggest pair wins. If red is highest, the colour leans red; if red and blue are both high, it is pink or purple.
  • All three pairs equal means grey. #333333 is dark grey, #CCCCCC light grey.
  • Higher overall means lighter. Codes full of E and F are pale; codes full of 0 to 3 are dark.
  • A small spread means a muted colour. #8A7F86 has pairs close together, so it is a greyish mauve; #FF1A6B has a big spread, so it is vivid.
HexRGBWhat it looks like
#FFFFFF255, 255, 255White
#0000000, 0, 0Black
#FF0000255, 0, 0Pure red
#00FF000, 255, 0Pure green
#0000FF0, 0, 255Pure blue
#FFFF00255, 255, 0Yellow (red + green light)
#808080128, 128, 128Mid grey
#14141420, 20, 20Near-black

What are 3-digit hex codes?

If both digits in every pair are the same, you can write each pair once. #FFF is #FFFFFF, #F46 is #FF4466. It only works for those doubled codes, so #EF466F has no shorthand. There are also 4 and 8-digit versions with transparency; see hex colour with opacity.

Where are hex codes used?

Everywhere colours are written down: CSS, Figma, Sketch, Canva, brand guidelines and most design tokens. Code for apps often needs RGB or 0–1 values instead, which is where a hex to RGB converter saves time. For when to pick hex, RGB or HSL in CSS, read HSL vs RGB vs hex.

Hex to RGB converterConvert hex colour codes to RGB, RGBA and HSL, and back. Free, no sign-up, runs in your browser.

Open the tool →

FAQ

What is a hex colour code?

It is a way to write an RGB colour as six hexadecimal digits after a #. Each pair sets the amount of red, green and blue from 00 to FF.

How many hex colours are there?

There are 16,777,216 six-digit hex colours, because each of the three channels has 256 possible values and 256 × 256 × 256 = 16,777,216.

What hex code is white?

White is #FFFFFF, or #FFF for short. Black is #000000, or #000.

Why do hex codes use letters?

Hexadecimal is base 16, so it needs sixteen digits. After 0 to 9 it uses A to F for the values 10 to 15.

Are hex codes case-sensitive?

No. #ef466f and #EF466F are exactly the same colour. Pick one style and use it consistently in your code and design files.

Last updated 16 November 2026. Sources are linked in the text. Spotted something out of date? Email development@digitalsauce.io.

Need a design system that ships?

Digital Sauce designs and builds apps and websites in Melbourne, from brand colours to the code.

Start a project →