03 · Converter

HEX to RGB converter, #FF8040 → 255, 128, 64.

Paste any hex color and read its red, green and blue components as a ready-to-paste rgb() function.

HEX color

#845EC2

rgb()

rgb(132, 94, 194)

Guide

What a hex code actually encodes

A six-digit hex color is three byte-sized numbers written in base 16 without separators. The first pair is red, the second is green and the third is blue, so reading #FF8040 is a matter of splitting it into FF, 80 and 40 and converting each pair back to decimal: 255, 128 and 64. That is the whole conversion — there is no rounding, no color profile and no loss, because both notations carry exactly the same 24 bits of information.

Hex feels opaque because it is a compact encoding chosen for brevity, not readability. RGB notation trades that compactness for transparency: once a color is expressed as channels, you can see at a glance that the green component is roughly half of red, or that a near-neutral gray has three numbers within a few points of each other. Decomposing a palette into RGB is often the fastest way to understand why two colors sit together the way they do.

Three-digit hex is the shorthand form of the same encoding: each digit is duplicated on expansion, so #F84 becomes #FF8844. It only round-trips when every pair happens to be a doubled digit, which is why converters output the full six digits — a shortened value that cannot be reversed without changing the color is a trap in shared code.

Using the HEX to RGB converter

Paste a code with or without the hash mark, or type a color in rgb() or hsl() notation and the field normalizes it to hex before converting. The output panel shows the decimal channels together with the complete rgb() function, so what you copy is ready to drop into a stylesheet, a Canvas fillStyle, a React inline style or a design token file without further editing.

The preview swatch beside the result updates as you type, which catches the common typo of transposing two digits — a mistake that produces a valid but completely different color. Random pulls a fresh value through the same path, and Reset restores the default so you can compare conversions against a known reference.

If the destination expects transparency, remember that six digits carry no alpha. CSS extends the notation to eight digits, with the final pair as opacity on the same 00 to FF scale, while rgb() switches to the rgba() function and takes alpha as a decimal between 0 and 1. Converting only the first six digits preserves the color and drops the transparency, which is usually the wrong half of the value to keep.

Frequently asked questions

How do I convert HEX to RGB?
Split the six digits into three pairs, then convert each pair from base 16 to decimal: the first digit contributes its value times 16 and the second adds its own value. For #FF8040 that is 15 × 16 + 15 = 255, 8 × 16 + 0 = 128, and 4 × 16 + 0 = 64, giving rgb(255, 128, 64).
Do I need to include the # symbol?
No. The converter accepts FF8040, #ff8040 and even color values pasted as rgb() or hsl(), and normalizes them before converting. The hash is only a marker in CSS that tells the parser a hex literal follows; the value itself is the six digits.
Why does my hex color look different after converting?
It should not — hex and RGB are two notations for the same 24-bit value, so the conversion is lossless. A visible difference means something else changed it: a color profile in the design tool, an alpha channel being dropped, or the browser applying color interpolation rather than the notation itself.