Contact, if you are interested in this website / domain name / Sponsorship / Advertisement / Partnership — web.works/contact
000098The #000098 Color Lab

Hex color codes explained: how #000098 and every other code works

By the 000098 editorial team · Updated · 7 min read

Every color on a web page can be written as a hex code: a hash sign followed by six characters, such as #000098. Designers copy them between tools, developers paste them into CSS, and brand guidelines list them next to Pantone and CMYK values. Once you understand the pattern, you can read a hex code almost as easily as a sentence.

The six digits are three pairs

A hex code is three two-digit numbers stuck together: RR GG BB. Each pair says how much red, green and blue light a screen pixel should emit. The digits are hexadecimal (base 16), so they run 0–9 and then A–F, where A means 10 and F means 15. Two hex digits can therefore express 16 × 16 = 256 values, from 00 (none) to FF (full).

Take #000098. Red is 00, green is 00, and blue is 98. Converting 98 from hex: 9 × 16 + 8 = 152. So #000098 is rgb(0, 0, 152): no red, no green and blue at about 60% of maximum. That is why it looks like deep ink or navy.

Converting hex to RGB by hand

  1. Split the code into three pairs.
  2. For each pair, multiply the first digit by 16 and add the second digit.
  3. Write the three results as rgb(R, G, B).

Example: #3A7BD5 → 3A = 3×16+10 = 58, 7B = 7×16+11 = 123, D5 = 13×16+5 = 213, giving rgb(58, 123, 213). Our color converter does this instantly and also returns HSL, CMYK, Lab and OKLCH.

How many hex colors are there?

With 256 levels per channel there are 256³ = 16,777,216 possible codes, from #000000 (black) to #FFFFFF (white). Human vision can distinguish a large share of these on a good display, which is why "24-bit color" became the standard for the web.

Shorthand and alpha

When each pair repeats a digit, CSS lets you shorten the code to three characters: #0099CC becomes #09C. #000098 cannot be shortened because 98 is not a repeated pair. Modern CSS also accepts eight-digit codes, where the last pair is opacity: #00009880 is #000098 at roughly 50% opacity (80 hex = 128 of 255).

Reading a code at a glance

  • Equal pairs (#777777) are grays.
  • Low numbers mean dark, high numbers mean light.
  • The biggest pair wins the hue: a large first pair is reddish, a large middle pair greenish, a large last pair bluish.
  • Two high pairs mix: red + green = yellow, green + blue = cyan, red + blue = magenta.

Upper or lower case?

Hex codes are case-insensitive: #00ff99 and #00FF99 are identical, as are #AbCdEf and #abcdef. Pick one style for your codebase and stick with it so diffs and searches stay clean.

Where hex falls short

Hex describes sRGB, the standard color space of most screens. It is not designed for print (use CMYK), and it is not perceptually even: the same numeric step can look large in one hue and tiny in another. For building scales and themes, newer formats such as OKLCH are easier to reason about. Hex remains the universal shorthand everyone understands, which is why it is still the default in design tools and brand books.

Watch: Understanding HEX color codes for web design

Video by its creator on YouTube, embedded for reference. 000098 is not affiliated with the channel.

Want this applied to your brand?

Get an accessible palette, tokens and a style guide built for you.

Get a free quote

Keep reading