What is Hex to RGB Converter?
A Hex to RGB Converter converts Hex into RGB directly in your browser. It parses the source format, applies the standard mapping or formula, and outputs the target format ready to copy. Convert #RRGGBB or #RGB to rgb(r, g, b) values.
Hex to RGB Converter
Convert HEX color codes to RGB. Live swatch preview.
TLDR
Paste a HEX color (#FF6699 or #F69), click Convert. The page outputs the RGB values.
How to use this tool
- Enter your inputs. Each field is labeled with what it expects.
- Read the result instantly. Numbers update as you type or change inputs.
- Adjust to test sensitivity. Change one input at a time to see what moves the result most.
- Cross-check the formula in the section below if you want to verify the math.
- Copy or screenshot the result for later. The site does not save anything; close the tab and inputs are gone.
About hex and RGB color
A hex color code is a compact way to write an RGB color using base-16 digits. RGB describes any on-screen color as a mix of three light channels (red, green, blue), each ranging from 0 to 255. A hex code packs those three numbers into a six-character string prefixed with a hash, where every two characters encode one channel in hexadecimal.
The two notations are interchangeable: #1E90FF and rgb(30, 144, 255) are the exact same dodger-blue color. Hex is favored in CSS, design tools, and style guides because it is short and copy-paste friendly, while the rgb() function is handy when you want to tweak a single channel or add transparency. This converter turns one into the other instantly so you can move between a designer's hex palette and code that expects numeric channels.
How it works: the conversion
Conversion is a digit-by-digit base change. Each hex pair is read as a two-digit base-16 number and rewritten in base 10, where the first digit is worth 16 and the second is worth 1.
#RRGGBB R = parseInt(RR, 16) // 0 to 255 G = parseInt(GG, 16) B = parseInt(BB, 16) One pair: value = 16 x first_digit + second_digit Example: FF = 16 x 15 + 15 = 255 Reverse: each channel -> two hex digits (0-9, A-F)
- RR, GG, BB = the red, green, and blue channel pairs in hexadecimal.
- Hex digits = 0 to 9 then A to F, where A is 10 and F is 15.
- Range = each channel spans 00 (0) to FF (255), giving 256 levels.
- Alpha = an optional fourth pair (#RRGGBBAA) sets opacity from 00 to FF.
Worked example
Convert the hex color #1E90FF to its rgb() equivalent.
- Split into pairs: 1E, 90, FF.
- Red (1E): 16 x 1 + 14 = 30.
- Green (90): 16 x 9 + 0 = 144.
- Blue (FF): 16 x 15 + 15 = 255.
- Assemble: rgb(30, 144, 255).
Common hex color reference
Frequently used colors in hex and RGB. The values are exact, not approximations.
| Color | Hex | RGB |
|---|---|---|
| White | #FFFFFF | rgb(255, 255, 255) |
| Black | #000000 | rgb(0, 0, 0) |
| Pure red | #FF0000 | rgb(255, 0, 0) |
| Teal (3Tej) | #0D9488 | rgb(13, 148, 136) |
| Dodger blue | #1E90FF | rgb(30, 144, 255) |
| Mid grey | #808080 | rgb(128, 128, 128) |
Common pitfalls
- Dropping the hash or a digit. A valid hex code is exactly 3, 6, or 8 hex digits after the hash. Five or seven digits are invalid.
- Confusing shorthand expansion. #1A5 expands to #11AA55 by doubling each digit, not to #1A5000.
- Treating channels as percentages. RGB channels run 0 to 255, not 0 to 100. FF is 255, the maximum, not 100 percent expressed as a number.
- Misreading the alpha pair. In #RRGGBBAA the last pair is opacity, so it changes transparency, not color.
- Assuming case matters. Hex is case-insensitive: #1e90ff and #1E90FF are identical, though uppercase is the common convention.
Frequently asked questions
How do I convert a hex color to RGB?
Split the six-digit hex code into three pairs and convert each pair from base 16 to base 10. For #1E90FF, the pairs are 1E, 90, and FF, which become 30, 144, and 255, giving rgb(30, 144, 255). Each pair represents one color channel (red, green, blue) and ranges from 00 to FF, or 0 to 255 in decimal.
What does each part of a hex color code mean?
A hex color is written as #RRGGBB. The first two characters are the red channel, the middle two are green, and the last two are blue. Each pair is a two-digit hexadecimal number from 00 (none) to FF (full), so #FF0000 is pure red, #00FF00 is pure green, and #0000FF is pure blue.
What is shorthand hex and how does it expand?
Three-digit shorthand like #1A5 expands by doubling each digit: #1A5 becomes #11AA55. It only works when each channel uses a repeated digit, which is why #FFF equals white (#FFFFFF) and #000 equals black. Most colors cannot be written in shorthand because their channel values are not made of repeated digits.
How do I add transparency to a hex color?
Use eight-digit hex (#RRGGBBAA), where the final pair is the alpha channel from 00 (fully transparent) to FF (fully opaque). For example #1E90FF80 is dodger blue at about 50 percent opacity, since 80 in hex is 128, roughly half of 255. The equivalent CSS is rgba(30, 144, 255, 0.5).
Why are there 16,777,216 possible hex colors?
Each of the three channels has 256 possible values (00 to FF), and 256 x 256 x 256 equals 16,777,216. This is the 24-bit truecolor space used by virtually all modern displays and image formats. Adding an 8-bit alpha channel makes it 32-bit color but does not increase the number of distinct hues.
