Skip to content

HEX ↔ RGB color converter

Convert colors between HEX (#RRGGBB) and RGB formats.

RGB
rgb(30, 144, 255)
R, G, B30, 144, 255
Normalized HEX#1E90FF

How the calculation works

Each HEX pair (#RRGGBB) is a 0–255 value in base 16. RGB uses the same three values in base 10. Converting just changes the base.

Examples

  • #FF0000 = rgb(255, 0, 0) = pure red.
  • #808080 = rgb(128, 128, 128) = mid gray.

Frequently asked questions

Do 3-digit HEX codes work?

Yes, #abc is the same as #aabbcc.

What does each HEX pair mean?

The three pairs are red, green and blue (RRGGBB), each 00 to FF (0 to 255).

How does transparency (alpha) work?

An 8-digit HEX (#RRGGBBAA) adds an alpha channel: 00 = transparent, FF = opaque.

Why are colours written in hexadecimal?

Because each channel is one byte (0–255) and a byte fits exactly two hex digits, matching the computer's binary structure.

How do I spot a grey from its code?

When all three pairs are equal (#333333, #CCCCCC). With no dominant channel the result is always grey.

What does a three-digit hex like #F90 mean?

It is shorthand: each digit doubles, so #F90 equals #FF9900. It only works when both digits in each pair match.

How do I add transparency?

With a fourth pair in #RRGGBBAA form, or with rgba() in CSS where alpha runs from 0 to 1.

Related calculators

More Tech / IT calculators

See all →

Updated on June 18, 2026 · by Rafael Rossi · Methodology & sources