Hex to RGB Converter

Quick answer

A hex to RGB converter changes a web colour between hexadecimal and RGB values, and shows its HSL. Choose a direction, then enter a hex code like #3498DB or three RGB numbers. For example, #3498DB is rgb(52, 152, 219), a shade of blue.

Updated 2026-09-09By Shakeel MuzaffarReviewed by Prof. Dr. Khalil Mudassar, PhD
Try
Converters
Direction
Used for Hex to RGB. Enter a hex code such as #3498DB or #ABC.
Used for RGB to Hex. Enter three numbers from 0 to 255, separated by commas.
Result
--
The other format--
HSL--

Calculations run in your browser. Inputs are not sent to our servers; anything you Save stays in this browser only.

Saved results (0)

How to Use the Hex to RGB Converter

  1. Choose a direction: hex to RGB, or RGB to hex.
  2. Enter a hex code like #3498DB, or three RGB numbers.
  3. Read the result.
  4. See the other format and the HSL values.

Here is what each result means:

ResultWhat it means
ResultThe colour in the format you converted to.
The other formatThe value you entered, tidied up.
HSLThe colour as hue, saturation and lightness.

What Is a Hex or RGB Colour?

On the web, colours are made by mixing red, green and blue light. RGB writes each of these three channels as a number from 0 to 255, so rgb(52, 152, 219) is a little red, more green and a lot of blue, giving a shade of blue. Zero means none of that colour and 255 means full strength.

A hex colour is the same three numbers written in hexadecimal, base 16, joined together after a hash. Each channel becomes two hex digits from 00 to FF, so #3498DB is 34 for red, 98 for green and DB for blue. Hex is popular in code and design tools because it is short and easy to copy.

Because they describe the same red, green and blue mix, hex and RGB are just two ways of writing one colour, and converting between them changes nothing about how it looks. HSL is a third way, describing a colour by its hue, saturation and lightness, which some designers find more intuitive for adjusting a shade.

How Does the Hex to RGB Converter Work?

It reads the colour and rewrites it in the other format, plus HSL.

Idea: each RGB channel from 0 to 255 equals two hex digits, since 255 is FF in hex. Converting just changes the base each channel is written in.
  1. For hex, each pair of digits is read as a channel value from 0 to 255.
  2. For RGB, each channel is written as two hex digits, padded with a zero if needed.
  3. The HSL values are worked out from the red, green and blue mix.

For the number side, see the base converter and the Roman numeral converter.

Hex to RGB Example

Convert #3498DB.

Result: it is rgb(52, 152, 219): red 52, green 152, blue 219. In HSL that is about hsl(204, 70%, 53%), a mid blue. Pure red, #FF0000, is rgb(255, 0, 0).

Common Colours in Hex and RGB

A few familiar colours in both formats.

ColourHexRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Green#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)

White is all channels at full, black is all at zero, and the pure primaries turn one channel fully on. Every other colour is a mix somewhere in between.

Comparing Hex, RGB and HSL

Three ways to write the same colour, each handy for a different task.

FormatDescribesGood for
HexRed, green, blue in base 16Copying in code
RGBRed, green, blue 0 to 255Clear channel values
HSLHue, saturation, lightnessAdjusting a shade

Hex and RGB are the same information in different bases. HSL rearranges it around hue and lightness, which makes it easier to make a colour lighter, darker or more vivid without guessing channel values.

What Affects the Colour

The Channel Values

Raising or lowering red, green or blue shifts the colour and its brightness.

Shorthand Hex

Three-digit hex like #ABC expands to #AABBCC, doubling each digit.

The Format Only, Not the Look

Converting between hex, RGB and HSL never changes how the colour appears.

When to Use a Hex to RGB Converter

Web Design

Switch a colour between hex and RGB for CSS or a design tool.

Matching Colours

Turn a hex code from a brand guide into RGB values.

Editing Shades

Read the HSL to lighten, darken or adjust a colour.

Common Mistakes

1. Forgetting the Hash

Hex colours are usually written with a leading hash, though this tool accepts them without it too.

2. RGB Out of Range

Each RGB channel runs from 0 to 255. Values outside that range are not valid.

3. Mixing Up the Order

Hex and RGB both go red, green, blue. Swapping channels gives a different colour.

4. Expanding Shorthand Wrongly

#ABC becomes #AABBCC, not #ABCABC; each digit is doubled.

5. Expecting Transparency

This covers opaque colours. Alpha, the fourth channel, is not included.

Accuracy and Limitations

Conversions are exact for standard six-digit and three-digit hex colours.

What it calculates accurately

  • Hex to RGB and RGB to hex
  • Three-digit shorthand hex
  • The HSL values

What it does not do

  • Handle alpha or transparency
  • Use named colours like "tomato"
  • Convert print colours such as CMYK
  • Show a live colour swatch

How We Convert Colours

Method
Reading each hex pair as a 0 to 255 channel, or writing each channel as two hex digits; HSL from the RGB mix.
Inputs used
A hex code, or three RGB numbers, with a direction toggle.
Assumptions
Standard opaque web colours; channels 0 to 255; six or three hex digits.
Rounding
HSL to whole degrees and percentages.
Edge cases
Three-digit hex is expanded; RGB values must be 0 to 255.

Frequently Asked Questions

How do you convert hex to RGB?

Read the hex code in pairs: the first two digits are red, the next two green, the last two blue, each from 00 to FF (0 to 255). #3498DB is rgb(52, 152, 219).

How do you convert RGB to hex?

Write each channel as two hex digits and join them after a hash. rgb(255, 0, 0) becomes #FF0000, since 255 is FF and 0 is 00.

What is a hex colour code?

A hex colour code is six hexadecimal digits, usually after a hash, giving the red, green and blue channels. #FFFFFF is white and #000000 is black.

What does #ABC mean?

It is shorthand hex. Each digit is doubled, so #ABC is the same as #AABBCC. It is a compact way to write colours whose channels have repeated digits.

What is the range of RGB values?

Each of the red, green and blue channels runs from 0 to 255. Zero is none of that colour and 255 is full strength.

What is HSL?

HSL describes a colour by hue, saturation and lightness instead of red, green and blue. It makes it easier to lighten, darken or adjust a shade.

Does this handle transparency?

No. It converts opaque colours only. Alpha, the fourth channel that sets transparency, is not included here.

Are hex and RGB the same colour?

Yes. They are just two ways of writing the same red, green and blue mix, so converting between them never changes how the colour looks.

Is my information saved?

No. The calculation runs in your browser and nothing you enter is stored or sent anywhere, unless you choose Save, which keeps the result only on this device.

Sources

Related Calculators

Looking for more converters?

Explore all converters

This converter changes a web colour between hexadecimal and RGB, and shows its HSL values. Hex colours use six hex digits for red, green and blue, such as #3498DB; RGB uses three numbers from 0 to 255. Three-digit shorthand hex like #ABC is also accepted. It covers standard opaque colours, not alpha transparency. Spotted an error? Let us know.

Creator

shakeel-Muzaffar
Founder & Editor-in-Chief at  ~ Web ~  More Posts

Shakeel Muzaffar is the Founder and Editor-in-Chief of MultiCalculators.com, bringing over 15 years of experience in digital publishing, product strategy, and online tool development. He leads the platform's editorial vision, ensuring every calculator meets strict standards for accuracy, usability, and real-world value. Shakeel personally oversees content quality, formula verification workflows, and the platform's commitment to publishing tools that are genuinely useful for students, professionals, and everyday users worldwide.

Areas of Expertise: Editorial Leadership, Digital Publishing, Product Strategy, Online Calculators, Web Standards