🔴

HEX ↔ RGB Converter

Convert colour values between HEX, RGB, HSL and CSS custom properties instantly. Free and runs entirely in your browser.

✓ Free forever✓ No signup✓ 100% private — runs in your browser

HEX ↔ RGB Converter

Convert between HEX, RGB, HSL, and CMYK color formats instantly.

HEX Input
rgb(124, 108, 255)
hsl(245, 100%, 71%)
cmyk(51%, 58%, 0%, 0%)
⇄
RGB Input
R (0–255)
G (0–255)
B (0–255)
#7c6cff
hsl(245, 100%, 71%)

Design tools, CSS and image editors all favour different colour notations, so converting between them is routine. The values are equivalent — only the notation changes.

How to use the HEX ↔ RGB Converter

  1. Enter a colour in any supported format
  2. Read the equivalent values in the other formats
  3. Copy the one you need

How HEX maps to RGB

A HEX colour is three pairs of hexadecimal digits, one per channel, each running from 00 to FF — that is 0 to 255 in decimal.

#7C6CFF
  7C → 124  (red)
  6C → 108  (green)
  FF → 255  (blue)

→ rgb(124, 108, 255)

The three-digit shorthand doubles each digit: #f0a expands to #ff00aa. It only works when both digits of every pair match, which is why not every colour has a shorthand.

Useful values to recognise

  • #000000 black · #FFFFFF white
  • #FF0000 pure red · #00FF00 pure green · #0000FF pure blue
  • Equal values in all three channels always give a neutral grey — #808080 is mid grey.

That last rule is a quick sanity check: if a colour is meant to be neutral and the three channel values differ, it has a colour cast.

Alpha, and the eight-digit hex notation

A fourth channel controls opacity, and there are several ways to express it.

Eight-digit hex appends an alpha pair: #7C6CFFCC is the same colour at 80% opacity. The four-digit shorthand expands the same way as three-digit does, so #F0A8 means #FF00AA88. Browser support has been universal for years.

The alpha pair runs 00 (transparent) to FF (opaque). Useful values: 80 is 50%, CC is 80%, 1A is 10%, 40 is 25%.

rgba() takes alpha as a decimal from 0 to 1, which is easier to reason about: rgba(124, 108, 255, 0.8). Modern CSS also allows rgb(124 108 255 / 80%) with the slash syntax.

One important distinction: alpha is not the same as opacity. Alpha applies to a single colour, so a semi-transparent background leaves the text on top fully opaque. The opacity property applies to the element and everything inside it, so text fades too. Using opacity to soften a background is a common cause of unreadable text.

Converting for print, and why CMYK is different

RGB is additive — it describes light, starting from black and adding. CMYK is subtractive — it describes ink on paper, starting from white and removing. They are not two notations for the same thing, and conversion between them is genuinely lossy.

The consequence is that some colours simply cannot be printed. Bright, saturated screen colours — vivid cyan, electric blue, neon green — sit outside the CMYK gamut entirely, and converting them produces the nearest printable approximation, which is usually noticeably duller. Designers who have only seen a logo on screen are often disappointed by the first proof.

There is also no single correct conversion. The result depends on the paper, the ink set, the press and the colour profile in use, which is why a printer will ask which profile to work to rather than accepting a CMYK value.

For brand work the usual answer is to define the colour in Pantone as the reference and derive the rest — Pantone specifies a physical ink, so it is consistent across presses in a way a CMYK breakdown is not.

If print matters, hand the printer your RGB or Pantone reference and let them convert with the right profile, rather than converting yourself and sending the result.

Frequently asked questions

Is HEX more precise than RGB?

No, they are identical. Both describe each channel with 8 bits — 256 levels. HEX is just a shorter way of writing the same numbers.

How does the three-digit shorthand work?

Each digit is doubled: #f0a becomes #ff00aa. It only works when both digits in every pair are the same, so most colours have no shorthand form.

What is HSL better for?

Manipulation. Making a colour darker, lighter or less saturated is a single-number change in HSL, and guesswork in HEX. For generating palettes it is much easier to reason about.

Can I convert to CMYK?

Not here. CMYK is for print and depends on the specific inks, paper and colour profile, so an accurate conversion needs those parameters rather than a formula.