FormatterHQ

HEX to RGB Converter

Turn hex color codes such as #0F766E or #abc into RGB channel values from 0 to 255. Type a code or pick a color and the RGB value updates as you type.

Loading tool…
Ready.

How to use the HEX to RGB Converter

  1. Type or paste a hex color such as #0F766E, #abc or 0x1E90FF into the HEX field, or choose one with Pick colour.
  2. The RGB field updates as you type and shows the rgb(r, g, b) value; the other fields show the same color as RGBA, HSL, HSV and CMYK.
  3. Use the copy button next to the RGB field and paste the value into your stylesheet, code or design tool.

Convert HEX to RGB color codes

A HEX to RGB converter takes a web color code like #0F766E and splits it into the three numbers a screen actually uses: red, green and blue intensity from 0 to 255. You need the RGB form whenever an API, shader, spreadsheet or design tool asks for separate channel values instead of a hex string.

How a hex color code maps to RGB

A six-digit hex code is three two-digit hexadecimal numbers in a row: #RRGGBB. Each pair is one byte, so it ranges from 00 (0) to FF (255). To convert a pair, multiply the first digit by 16 and add the second, where the letters A–F stand for 10–15.

#0F766E
0F → 0 × 16 + 15 =  15   (red)
76 → 7 × 16 + 6  = 118   (green)
6E → 6 × 16 + 14 = 110   (blue)
→ rgb(15, 118, 110)

A second example: #1E90FF (the CSS color dodgerblue) gives 1E = 30, 90 = 144 and FF = 255, so rgb(30, 144, 255). The hex to decimal converter uses the same place-value method for numbers of any size if you want more practice with base 16.

Shorthand and other accepted inputs

  • Three-digit shorthand. #abc means #aabbcc: every digit is doubled, not padded with a zero. So #abc is rgb(170, 187, 204) and #fff is white, rgb(255, 255, 255).
  • With or without the hash. 0F766E, #0f766e and 0x0F766E are read the same way, and letter case doesn't matter.
  • CSS color names. Names such as tomato or rebeccapurple are recognized and converted from their standard hex values.
  • Eight- and four-digit hex. #RRGGBBAA and #RGBA carry an alpha (opacity) byte. RGB has no slot for it, so the alpha is simply left out; the color channels are not blended with any background. Use HEX to RGBA when you need to keep the transparency.

Five- or seven-digit codes are not valid colors. They produce an error that quotes the offending value, so a typo can't slip through as a wrong color.

Where RGB values are needed

CSS accepts both notations, so on the web the choice is mostly style. RGB becomes necessary elsewhere: the Canvas API stores pixel data as 0–255 channel bytes, many charting and game libraries take three integers, and spreadsheets often keep colors as separate columns. Shader code and some engines expect 0–1 floats instead; divide each value by 255 (118 ÷ 255 ≈ 0.463).

Common mistakes

  • Wrong byte order. Web hex is always red, green, blue (then alpha). Android and XAML put alpha first (#AARRGGBB), so an eight-digit code copied from those platforms means something else in CSS.
  • Zero-padding shorthand. #abc is not #0a0b0c.
  • Look-alike characters. Only 0–9 and A–F are valid; the letter O is a frequent typo for zero.

Going the other way? The RGB to HEX converter reverses the process. The conversion runs entirely in your browser, so the colors you enter are never uploaded.

Frequently asked questions

What is #FFFFFF in RGB?
#FFFFFF is white, rgb(255, 255, 255): every channel is at its maximum of FF = 255. Its opposite, #000000, is black, rgb(0, 0, 0).
How do I convert a 3-digit hex code to RGB?
Double each digit first, then convert the pairs. #F60 becomes #FF6600, which is rgb(255, 102, 0). The tool does this expansion automatically.
What happens to the alpha in an 8-digit hex code?
The RGB field leaves it out, because rgb() has only three channels. The red, green and blue values are returned unchanged. The RGBA field on the same page shows the opacity as a decimal.
Is HEX or RGB better for CSS?
Neither is more accurate; #0F766E and rgb(15, 118, 110) are exactly the same color. Hex is shorter and common in brand guides, while rgb() is easier to read and lets you add an alpha value directly.
Why is my hex code rejected?
A valid hex color has 3, 4, 6 or 8 digits using only 0–9 and A–F. Check for a missing or extra digit, stray spaces inside the code, or a letter O typed instead of a zero.

Last updated October 3, 2026

Related tools

RGB to HEX Converter Convert RGB colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. CMYK to HEX Converter Convert CMYK colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. CMYK to RGB Converter Convert CMYK colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons. Colortone to HEX Converter Convert a named colour tone (e.g. steelblue, tomato) or any colour to HEX, with its tints, shades and tones. Colortone to RGB Converter Convert a named colour tone (e.g. steelblue, tomato) or any colour to RGB, with its tints, shades and tones. HEX to CMYK Converter Convert HEX colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HEX to RGBA Converter Convert HEX colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to CMYK Converter Convert HSL colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to HEX Converter Convert HSL colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to HSV Converter Convert HSL colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to RGB Converter Convert HSL colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to RGBA Converter Convert HSL colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons.