hex-cmyk

Converter

HEX to RGB Converter

Hex and RGB describe exactly the same colour in two different notations. This page converts between them and explains what the digits are actually doing.

or pick it visually
Preview

C
M
Y
K
SUM
RGB
HEX
HSL
CMYK

Need it the other way round?RGB to HEX converter

These values are mathematical approximations. Ink, paper, press calibration and colour profile all change the printed result — always approve colour from a physical proof. Full disclaimer.

How the conversion works #

There is no real arithmetic here, only a change of base. Six hex digits are three pairs, and each pair is one channel written in base 16.

#1E90FF   1E → R   90 → G   FF → B   // each pair: (first digit × 16) + second digit // where A=10, B=11, C=12, D=13, E=14, F=15

A worked example #

  1. 1E: the 1 is worth 16, the E is worth 14. 16 + 14 = 30, the red channel.
  2. 90: the 9 is worth 9 × 16 = 144, the 0 adds nothing. Green is 144.
  3. FF: 15 × 16 = 240, plus 15 = 255. Blue is at maximum.
  4. So #1E90FF is rgb(30, 144, 255): a little red, a moderate amount of green, all the blue.

The three lengths you will encounter #

  • Three digits — shorthand. Each digit doubles: #F0A becomes #FF00AA.
  • Six digits — the standard form, one pair per channel.
  • Eight digits — six plus an alpha pair. #1E90FF80 is that blue at about half opacity.

The converter above accepts all three, with or without the leading hash.

Common hex to RGB values #

ColourHEXRGBHSL
Black#0000000, 0, 00°, 0%, 0%
White#FFFFFF255, 255, 2550°, 0%, 100%
Red#FF0000255, 0, 00°, 100%, 50%
Lime#00FF000, 255, 0120°, 100%, 50%
Blue#0000FF0, 0, 255240°, 100%, 50%
Yellow#FFFF00255, 255, 060°, 100%, 50%
Cyan#00FFFF0, 255, 255180°, 100%, 50%
Magenta#FF00FF255, 0, 255300°, 100%, 50%
Dodger blue#1E90FF30, 144, 255210°, 100%, 56%
Navy#0000800, 0, 128240°, 100%, 25%
Teal#0080800, 128, 128180°, 100%, 25%
Forest green#228B2234, 139, 34120°, 61%, 34%
Olive#808000128, 128, 060°, 100%, 25%
Orange#FFA500255, 165, 039°, 100%, 50%
Crimson#DC143C220, 20, 60348°, 83%, 47%
Maroon#800000128, 0, 00°, 100%, 25%
Purple#800080128, 0, 128300°, 100%, 25%
Hot pink#FF69B4255, 105, 180330°, 100%, 71%
Silver#C0C0C0192, 192, 1920°, 0%, 75%
Charcoal#36454F54, 69, 79204°, 19%, 26%

Click any row to load that colour into the converter.

Questions #

Why is hex base 16 rather than base 10?

Because one byte holds values from 0 to 255, and 255 is exactly FF in base 16 — two digits, no waste. Three colour channels then fit in exactly six characters. In base 10 you would need up to nine digits and separators to do the same job.

What does the fourth pair in an eight-digit code mean?

Alpha, meaning opacity. FF is fully opaque and 00 is fully transparent. So #1E90FF80 is that blue at roughly 50% opacity. Browsers have supported this for years; it is a compact alternative to writing rgba().

Is #FFF the same as #FFFFFF?

Yes. Three-digit shorthand doubles each digit, so #FFF expands to #FFFFFF and #F0A expands to #FF00AA. Only colours where each pair happens to be a repeated digit can be written short.

Does capitalisation matter?

No. #1e90ff and #1E90FF are the same colour. Pick one convention and keep it consistent across a codebase, which matters for diffs and search rather than for rendering.

How many colours can hex describe?

256 values per channel across three channels gives 16,777,216 combinations. That is more than the eye can distinguish in most contexts, which is why 24-bit colour became the standard.