Skip to content
ToolboxHere home

HEX to RGB

Type a hex colour code, three, six or eight digits, and read its red, green and blue values at once, with rgb() or rgba ready to copy, plus HSL, CMYK, Swift and Android forms and the contrast on white and black.

  • Nothing you type leaves your device
  • 100% free
  • No sign-up
  • Instant results
HEX to RGBA hex colour code to its RGB values (and HSL, CMYK and the rest), with the swatch and contrast.Starting… the tool runs entirely in your browser and needs JavaScript.

How to use HEX to RGB

  1. Type the hex code, with or without #: 1e90ff, #fff, or #1e90ff80 with alpha.
  2. Copy the RGB row (rgb(30, 144, 255)), or any other format.
  3. Check the swatch and the WCAG contrast before using it for text.
  4. Type an rgb() value instead to convert the other way.

Why use HEX to RGB

Short and long hex

#fff, #ffffff and #ffffff80 (with alpha) are all read; the RGB form keeps the alpha.

Every other form

HSL, HSB, HWB, CMYK, 0–1 values, Swift Color and Android 0xFF hex.

Contrast

The WCAG ratio on white and black, so you know if the colour works for text.

Both ways

Type rgb() and read the hex; the page converts in every direction.

About this tool

A hex colour is three bytes of red, green and blue written in hexadecimal: #1e90ff is 30 red, 144 green, 255 blue. CSS accepts both, but JavaScript canvas code, older CSS, design tools and many APIs want the decimal rgb() form, and a fourth pair of digits carries transparency. Converting is a two-line calculation that is easy to get wrong in a hurry, so this page does it as you type.

It is the same converter as the full colour page, opened on a hex value, so HSL, CMYK, app-code forms, tints and shades and the contrast check are all here too. Nothing leaves your browser.

Frequently asked questions

How do I convert #1e90ff to RGB by hand?

Split it into pairs: 1e, 90, ff. Each pair is a hex number: 1e = 30, 90 = 144, ff = 255, so rgb(30, 144, 255).

What does a 3-digit hex mean?

Each digit is doubled: #fa3 is #ffaa33.

What are the last two digits of an 8-digit hex?

Transparency, 00 (clear) to ff (solid). #1e90ff80 is the same blue at 50% opacity, rgb(30 144 255 / 0.5).

Is RGB or hex better in CSS?

They are the same colour; hex is shorter, rgb() is easier to read and to give an alpha. Modern CSS also allows rgb(30 144 255 / 50%).

Can it convert RGB to hex too?

Yes. Type rgb(30, 144, 255) or 30, 144, 255 and copy the HEX row.

Related tools