InfyCalculator

Hex to RGB Converter

Convert any hex color code — #aabbcc or shorthand #abc — to its red, green and blue values and a ready-to-paste rgb() string.

Hex color
Loading calculator…

How it works

channel = first digit × 16 + second digit (hex digits a–f = 10–15)

A hex color packs three 0–255 channels into base-16 pairs: #RRGGBB. Convert each pair by multiplying the first digit by 16 and adding the second — "ff" is 15×16 + 15 = 255. Shorthand #abc doubles each digit to #aabbcc, so #f80 expands to #ff8800. Case never matters.

Worked example

#ff8000: ff = 255, 80 = 8×16 + 0 = 128, 00 = 0 — so the color is rgb(255, 128, 0), a pure orange with no blue.

Frequently asked questions

What about hex codes with 8 digits?

The extra pair is alpha (opacity): #ff800080 is the same orange at 50% opacity, since 80 hex = 128 ≈ half of 255. Convert the first six digits here and append the alpha as rgba()’s fourth value (128 ÷ 255 ≈ 0.5).

Why hex instead of plain RGB numbers?

Compactness and history: one byte per channel is exactly two hex digits, so a full color is six characters. CSS accepts both — rgb() tends to be easier to tweak mentally, hex easier to copy around.

Is #FFF the same as #FFFFFF?

Yes — shorthand duplicates each digit, so #fff expands to #ffffff (white). Note the shorthand can only express colors whose pairs are doubled digits: #ff8000 has no 3-digit form.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.