Tools.GamesLoop Logo
TOOLS.GAMESLOOP160+ Free Online Tools

Convert HEX to RGB

Convert a hex colour code to RGB values.

HEX to RGB Converter

Developer tool running locally in browser

Advertisement
Ad Space (auto) — Configurable via NEXT_PUBLIC_ADSENSE_CLIENT

What does HEX to RGB Converter do?

Convert a hexadecimal colour code to its red, green and blue components, with support for 3, 4, 6 and 8 digit forms. The 8-digit form carries an alpha channel, which becomes the fourth value in rgba().

How to Use HEX to RGB Converter

  1. 1
    Enter the hex codeWith or without the leading hash.
  2. 2
    Read the RGB valuesShown as numbers and as a CSS rgb() string.
  3. 3
    Copy itOne tap for the CSS form.

Key Features

  • 3, 4, 6 and 8 digit hex accepted
  • Alpha channel converted to the rgba() fourth value
  • Live colour swatch
  • Ready-to-paste CSS declaration
  • Explains the maths so you can do it by hand

Frequently Asked Questions

How does the conversion work?

Each pair of hex digits is a base-16 number from 00 to FF, which is 0 to 255 in decimal. #FF8800 is red 255, green 136, blue 0.

What does a 3-digit hex code mean?

It is shorthand where each digit is doubled. #F80 expands to #FF8800. It can only express 4,096 of the 16.7 million possible colours, so it is only used when the colour happens to fit.

What is the 8th digit for?

Alpha, or opacity. #4F46E580 has an alpha of 0x80 = 128, which is 50% opacity — equivalent to rgba(79, 70, 229, 0.5). Every current browser supports it.

Which should I use in CSS?

Either — they are identical to the browser. Hex is more compact and more common in design tools; rgb() is easier to manipulate in code because the components are separate numbers.