Hex to RGB Converter

Hex to RGB Converter. Enter your Hex Color and the Hex to RGB Converter instantly breaks it down into RGB Output. Use the binary to hex converter to turn a long binary string into hexadecimal without manually grouping bits by hand.

Paste any six-digit code into this hex to RGB converter and you get the three screen values behind it, so #C4572B becomes rgb(196, 87, 43) instantly, in a single click. It is a free tool built for designers and developers who need exact channel numbers for CSS, canvas code or a design handoff, and the sections below explain how every digit is read.

How a Hex to RGB Converter Works

A hex color code is a hex triplet: a six-digit, three-byte number written in hexadecimal (base sixteen). Each byte holds one color level from 00 to FF, which is 0 to 255 in decimal. The first byte is red, the second is green and the third is blue, which is why the same color can be written as #C4572B or as three plain numbers. The fastest way to check a BCD encoding is to paste it into the bcd to decimal converter and click Convert.

Every hex to RGB conversion follows one rule: split the code into pairs, then turn each pair into a base-10 number.

$$\text{value} = (d_1 \times 16) + d_2$$

In that formula, \(d_1\) is the left digit of a pair and \(d_2\) is the right digit, with A to F standing for 10 to 15. The digit weights are what make base sixteen compact: the left digit counts sixteen times, the right digit counts once.

Reading the Left, Middle and Right Digits

The left digits of the code (the first pair) give red, the middle digits give green, and the right digits give blue. Reading a code by position is the fastest way to estimate a color before you convert it: a large first pair means a warm, red-heavy color, while a large last pair points to blue.

A Worked Example with #C4572B

Take the burnt-orange code #C4572B. Drop the leading hash, split it into C4, 57 and 2B, and apply the formula to each pair:

A Worked Example with #C4572B
PairCalculationDecimal value
C4 (red)(12 × 16) + 4196
57 (green)(5 × 16) + 787
2B (blue)(2 × 16) + 1143

The result is rgb(196, 87, 43). Nothing is lost along the way, because each byte maps exactly one-to-one onto an integer from 0 to 255, so the conversion has no rounding and no loss of precision.

Bar chart of the red, green and blue channel values 196, 87 and 43 from converting hex color code #C4572B to RGB
The three RGB channel values behind #C4572B.
Waterfall chart showing hex pair C4 as 192 plus 4, totalling a red value of 196
How the red pair C4 builds to 196 in decimal.

Using the Hex to RGB Color Converter Tool

The hex to RGB color converter is a simple tool with one job: you enter a hex code and it returns the RGB values the moment you click Convert. It runs in your browser, never asks you to sign in and works as a free online tool for as many codes as you like, so this color notation tool is always one paste away.

  1. Open the tool, then type or paste your hex code, with or without the # symbol.
  2. Click the Convert button.
  3. Read the red, green and blue values from the tool, plus the live preview swatch that shows the color.
  4. Copy the rgb() string straight into your stylesheet.

Supported Formats: Shorthand and 8-Digit Hex

Three notations are common. Shorthand writes each pair as one repeated digit, so #3A9 expands to #33AA99, which is rgb(51, 170, 153). The long form is #RRGGBB. The 8-digit hex form adds a fourth byte, covered next.

Alpha Channel and RGBA Output

An alpha channel controls opacity. In an 8-digit code the last pair is the alpha byte, and FF means fully opaque. Divide the alpha byte by 255 to get a 0 to 1 decimal: #C4572B80 has alpha 80 in hex, which is 128 in decimal, so the output is rgba(196, 87, 43, 0.5). The alpha is a close approximation after rounding, while the three color channels stay exact.

Hex Color Codes and Common Colors Table

Memorising a handful of hex color codes makes every other value easier to judge. This hex to RGB color table lists the basic colors you will meet most often, each with its color name and its RGB triple. The hex to hsv converter takes a hex color and works out its hue, saturation, and value in one step.

Hex Color Codes and Common Colors Table
Color nameHexRGB
Black#000000(0, 0, 0)
White#FFFFFF(255, 255, 255)
Red#FF0000(255, 0, 0)
Green#00FF00(0, 255, 0)
Blue#0000FF(0, 0, 255)
Yellow#FFFF00(255, 255, 0)
Cyan#00FFFF(0, 255, 255)
Magenta#FF00FF(255, 0, 255)
Gray#808080(128, 128, 128)
Silver#C0C0C0(192, 192, 192)
Maroon#800000(128, 0, 0)
Olive#808000(128, 128, 0)
Teal#008080(0, 128, 128)
Navy#000080(0, 0, 128)

Notice the pattern: when only one pair is FF you get a pure primary, when two are FF you get a secondary like yellow, and when all three pairs match you get a shade of gray between black and white.

Why RGB Is an Additive Color Model

RGB is an additive color model: red, green and blue light are added together in different amounts to produce the colors on a display. Those three primary colors are the base of every screen, where each pixel mixes three tiny lights. Full red, green and blue together give white; none of them gives black. That is the opposite of print, where inks subtract light.

sRGB and the Web

The default color space on the web is sRGB, shared by HTML, CSS and SVG. Hex and RGB are two spellings of one sRGB color, so the tool changes the notation, not the color, and converting back returns the same value.

Checking Contrast from a Brand Hex Color Code

A frontend developer, Priya, gets a style guide that lists the button color only as #1F6F5C. Her accessibility script wants three integers, and she needs to know whether white button text clears the WCAG AA threshold of 4.5:1 for normal text. So she pastes the code into the converter and clicks the Convert button to get the RGB channels.

It splits the code into 1F, 6F and 5C and returns rgb(31, 111, 92): 31 for red, 111 for green, 92 for blue. The live preview shows a deep teal green, which matches the mockup, so she knows she typed the right pair order.

The converted channels are what her contrast script needs: its relative luminance for them is 0.124, which against white gives 6.02:1, above the 4.5:1 AA minimum, so the button text can stay white.

A second conversion settles the hover state. The design lead proposes a lighter #2E9B7F; converting it gives rgb(46, 155, 127), and the same script reports 3.44:1, which fails AA. Priya keeps the base color, asks for a darker hover shade, and converts that replacement the same way before it goes into the stylesheet.

Where a Color Code Converter Helps Developers

A color code in hex is compact, but channel values are plain integers, which are easier to manipulate programmatically. You will want them when you tween a color, mix two colors, or compare values in canvas and WebGL code, where a shader often needs each channel on its own. Many frontend teams also convert so that a stylesheet can use rgb() or rgba() syntax, and two or three channels at a time can be adjusted with plain arithmetic.

  • Design handoff: turn a brand hex into the numbers a spec sheet asks for.
  • Opacity layers: add alpha when a color has to sit over an image.
  • Gradients: write start and end colors as RGB so a gradient can be interpolated.
  • Accessibility: a contrast check under WCAG needs the RGB channels to compute luminance, and good accessibility starts there.
  • Computing: scripts, spreadsheets and design tokens often store colors as three numbers.

Beyond RGB: HSL, HSV and CMYK Values

A good color converter does not stop at RGB. The same #C4572B can be described in several color models, each answering a different question about the color, and each one is a notation of the same light.

Beyond RGB: HSL, HSV and CMYK Values
ModelValue for #C4572BBest for
RGB196, 87, 43Screens and code
HSL17°, 64%, 47%Adjusting lightness in CSS
HSV17°, 78%, 77%Color pickers
CMYK0%, 56%, 78%, 23%Print approximations
Dumbbell chart comparing HSL and HSV saturation and lightness for the same hex color
The same color described in HSL and HSV.

RGB to Hex Converter: Going the Other Way

The reverse trip uses an RGB to hex converter: divide each channel by 16, write the quotient and remainder as hex digits, and join the three pairs. For 196 that is 12 remainder 4, which is C4. The model is symmetrical, so hex to RGB and back always agrees.

Hex to Decimal and Palette Work

Under the hood each pair is a simple hex to decimal step, and the decimals the converter returns are what you reuse downstream. Feed them into a color palette script to derive a lighter tint, or store them as design tokens so a whole system shares one set of channel values. A color picker can hand you the original hex, and approximate matches in spaces such as OKLCH or Pantone start from the same three numbers.

Common Mistakes When You Convert Hex to RGB

Most errors come from a few repeat slips when you convert hex to RGB by hand:

  • Reading B as 8 instead of 11 (letters A to F run from 10 to 15).
  • Forgetting that a shorthand digit is doubled, so #3A9 is not #3A9000.
  • Treating the alpha pair of an 8-digit code as a fourth color instead of opacity.
  • Expecting a hex to RGB conversion to look identical on every light setting or screen: the numbers are exact, but a display's calibration can still shift how they look.

A reliable tool removes these slips; the converter also returns CMYK and HSL, so you can sanity-check a print or CSS value against the CMYK numbers, and a quick check on the common conversions in the table above confirms the result in seconds.